D7191: py3: fix exception display encoding in contrib/simplemerge.py
touilleMan (Leblond Emmanuel)
phabricator at mercurial-scm.org
Fri Nov 1 16:46:50 UTC 2019
touilleMan created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7191
AFFECTED FILES
contrib/simplemerge
CHANGE DETAILS
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)
To: touilleMan, #hg-reviewers
Cc: mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list