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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Mar 4 18:01:12 UTC 2018


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

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'
 



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


More information about the Mercurial-devel mailing list