Patchwork D2535: py3: use pycompat.bytestr() to convert error messages to bytes

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

Comments

phabricator - March 3, 2018, 8:16 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2f7a3c90c0d7: py3: use pycompat.bytestr() to convert error messages to bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2535?vs=6433&id=6464

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

AFFECTED FILES
  hgext/gpg.py
  hgext/journal.py
  hgext/largefiles/overrides.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -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
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -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()
diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -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"""