Patchwork D2649: py3: use util.forcebytestr instead of str to convert error messages

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 6:01 p.m.
Message ID <e0b2e7d38ade37ecdaa8e4f0bdfb645a@localhost.localdomain>
Download mbox | patch
Permalink /patch/28944/
State Not Applicable
Headers show

Comments

phabricator - March 4, 2018, 6:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf659a407e5ee: py3: use util.forcebytestr instead of str to convert error messages (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2649?vs=6563&id=6568

REVISION DETAIL
  https://phab.mercurial-scm.org/D2649

AFFECTED FILES
  mercurial/hg.py
  mercurial/repair.py
  mercurial/revlog.py

CHANGE DETAILS




To: pulkit, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1996,7 +1996,8 @@ 
             try:
                 return _zlibdecompress(data)
             except zlib.error as e:
-                raise RevlogError(_('revlog decompress error: %s') % str(e))
+                raise RevlogError(_('revlog decompress error: %s') %
+                                  util.forcebytestr(e))
         # '\0' is more common than 'u' so it goes first.
         elif t == '\0':
             return data
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -235,7 +235,7 @@ 
             except OSError as e:
                 if e.errno != errno.ENOENT:
                     ui.warn(_('error removing %s: %s\n') %
-                            (undovfs.join(undofile), str(e)))
+                            (undovfs.join(undofile), util.forcebytestr(e)))
 
     except: # re-raises
         if backupfile:
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -269,7 +269,7 @@ 
             # ValueError is raised on Windows if the drive letters differ on
             # each path
             raise error.Abort(_('cannot calculate relative path'),
-                              hint=str(e))
+                              hint=util.forcebytestr(e))
     else:
         requirements += 'shared\n'