py3: use pycompat.bytestr() to convert error messages to bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 02 Mar 2018 07:13:33 +0530
changeset 36682 2f7a3c90c0d7
parent 36681 8381126bf43c
child 36683 b864f4536ca8
py3: use pycompat.bytestr() to convert error messages to bytes Differential Revision: https://phab.mercurial-scm.org/D2535
hgext/gpg.py
hgext/journal.py
hgext/largefiles/overrides.py
--- a/hgext/gpg.py	Sat Mar 03 14:28:51 2018 -0500
+++ b/hgext/gpg.py	Fri Mar 02 07:13:33 2018 +0530
@@ -318,7 +318,7 @@
         repo.commit(message, opts['user'], opts['date'], match=msigs,
                     editor=editor)
     except ValueError as inst:
-        raise error.Abort(str(inst))
+        raise error.Abort(pycompat.bytestr(inst))
 
 def node2txt(repo, node, ver):
     """map a manifest into some text"""
--- a/hgext/journal.py	Sat Mar 03 14:28:51 2018 -0500
+++ b/hgext/journal.py	Fri Mar 02 07:13:33 2018 +0530
@@ -508,7 +508,7 @@
                     ctx = repo[hash]
                     displayer.show(ctx)
                 except error.RepoLookupError as e:
-                    fm.write('repolookuperror', "%s\n\n", str(e))
+                    fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e))
             displayer.close()
 
     fm.end()
--- a/hgext/largefiles/overrides.py	Sat Mar 03 14:28:51 2018 -0500
+++ b/hgext/largefiles/overrides.py	Fri Mar 02 07:13:33 2018 +0530
@@ -598,7 +598,7 @@
     try:
         result = orig(ui, repo, pats, opts, rename)
     except error.Abort as e:
-        if str(e) != _('no files to copy'):
+        if pycompat.bytestr(e) != _('no files to copy'):
             raise e
         else:
             nonormalfiles = True
@@ -705,7 +705,7 @@
                 lfdirstate.add(destlfile)
         lfdirstate.write()
     except error.Abort as e:
-        if str(e) != _('no files to copy'):
+        if pycompat.bytestr(e) != _('no files to copy'):
             raise e
         else:
             nolfiles = True