changeset 36653:2f7a3c90c0d7

py3: use pycompat.bytestr() to convert error messages to bytes Differential Revision: https://phab.mercurial-scm.org/D2535
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 02 Mar 2018 07:13:33 +0530
parents 8381126bf43c
children b864f4536ca8
files hgext/gpg.py hgext/journal.py hgext/largefiles/overrides.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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