Patchwork D2585: py3: use util.forcevytestr to convert error to bytes

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

Comments

phabricator - March 3, 2018, 4:33 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9e2866065982: py3: use util.forcevytestr to convert error to bytes (authored by pulkit, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D2585?vs=6434&id=6437#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2585?vs=6434&id=6437

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

AFFECTED FILES
  hgext/convert/subversion.py
  hgext/mq.py
  hgext/narrow/narrowbundle2.py
  hgext/relink.py

CHANGE DETAILS




To: pulkit, durin42, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/hgext/relink.py b/hgext/relink.py
--- a/hgext/relink.py
+++ b/hgext/relink.py
@@ -187,7 +187,7 @@ 
             relinked += 1
             savedbytes += sz
         except OSError as inst:
-            ui.warn('%s: %s\n' % (tgt, str(inst)))
+            ui.warn('%s: %s\n' % (tgt, util.forcebytestr(inst)))
 
     ui.progress(_('relinking'), None)
 
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -449,7 +449,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)))
 
     # Remove partial backup only if there were no exceptions
     vfs.unlink(chgrpfile)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -723,7 +723,8 @@ 
         try:
             os.unlink(undo)
         except OSError as inst:
-            self.ui.warn(_('error removing undo: %s\n') % str(inst))
+            self.ui.warn(_('error removing undo: %s\n') %
+                         util.forcebytestr(inst))
 
     def backup(self, repo, files, copy=False):
         # backup local changes in --force case
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -147,7 +147,7 @@ 
         # Caller may interrupt the iteration
         pickle.dump(None, fp, protocol)
     except Exception as inst:
-        pickle.dump(str(inst), fp, protocol)
+        pickle.dump(util.forcebytestr(inst), fp, protocol)
     else:
         pickle.dump(None, fp, protocol)
     fp.flush()