Patchwork D7191: py3: fix exception display encoding in contrib/simplemerge.py

login
register
mail settings
Submitter phabricator
Date Nov. 1, 2019, 5:28 p.m.
Message ID <1b2aace2ffdf9fb03f73921dc39f6368@localhost.localdomain>
Download mbox | patch
Permalink /patch/42665/
State Not Applicable
Headers show

Comments

phabricator - Nov. 1, 2019, 5:28 p.m.
Closed by commit rHGe54da18c421e: py3: fix exception display encoding in contrib/simplemerge.py (authored by touilleMan).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7191?vs=17445&id=17456

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7191/new/

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

AFFECTED FILES
  contrib/simplemerge

CHANGE DETAILS




To: touilleMan, #hg-reviewers, indygreg
Cc: mjpieters, mercurial-devel

Patch

diff --git a/contrib/simplemerge b/contrib/simplemerge
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -18,6 +18,7 @@ 
 )
 from mercurial.utils import (
     procutil,
+    stringutil
 )
 
 options = [(b'L', b'label', [], _(b'labels to use on conflict markers')),
@@ -75,8 +76,7 @@ 
                                      context.arbitraryfilectx(other),
                                      **pycompat.strkwargs(opts)))
 except ParseError as e:
-    if pycompat.ispy3:
-        e = str(e).encode('utf8')
+    e = stringutil.forcebytestr(e)
     pycompat.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))
     showhelp()
     sys.exit(1)