[PATCH 05 of 10 py3] dispatch: convert exception payload to bytes more carefully
Augie Fackler
raf at durin42.com
Mon May 29 10:32:27 EDT 2017
# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1496000820 14400
# Sun May 28 15:47:00 2017 -0400
# Node ID 47cbf6238b4a62cead3dc90a4021f7c34ae16f4e
# Parent 6e1ab7424617c7c7afca7faab559507c5e816a9c
dispatch: convert exception payload to bytes more carefully
We were previously depending on str() doing something reasonable here,
and we can't depend on the objects in question supporting __bytes__,
so we work around the lack of direct bytes formatting.
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -319,7 +319,8 @@ def _callcatch(ui, func):
except error.CommandError as inst:
if inst.args[0]:
ui.pager('help')
- ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
+ msgbytes = encoding.unitolocal(str(inst.args[1]))
+ ui.warn(_("hg %s: %s\n") % (inst.args[0], msgbytes))
commands.help_(ui, inst.args[0], full=False, command=True)
else:
ui.pager('help')
More information about the Mercurial-devel
mailing list