changeset 43367:3c2799cbace4 stable

py3: fix exception display encoding in contrib/simplemerge.py Differential Revision: https://phab.mercurial-scm.org/D7191
author Emmanuel Leblond <emmanuel.leblond@gmail.com>
date Fri, 01 Nov 2019 17:23:02 +0100
parents ee3a55c8fd0f
children d8215ff082da
files contrib/simplemerge
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/simplemerge	Fri Nov 01 17:31:47 2019 +0100
+++ b/contrib/simplemerge	Fri Nov 01 17:23:02 2019 +0100
@@ -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)