comparison mercurial/dispatch.py @ 32620:3ce53a499334

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.
author Augie Fackler <raf@durin42.com>
date Sun, 28 May 2017 15:47:00 -0400
parents 1b90036f42f0
children 9929af2b09b4
comparison
equal deleted inserted replaced
32619:d110fb58424c 32620:3ce53a499334
317 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % 317 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
318 (inst.args[0], " ".join(inst.args[1]))) 318 (inst.args[0], " ".join(inst.args[1])))
319 except error.CommandError as inst: 319 except error.CommandError as inst:
320 if inst.args[0]: 320 if inst.args[0]:
321 ui.pager('help') 321 ui.pager('help')
322 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) 322 msgbytes = pycompat.bytestr(inst.args[1])
323 ui.warn(_("hg %s: %s\n") % (inst.args[0], msgbytes))
323 commands.help_(ui, inst.args[0], full=False, command=True) 324 commands.help_(ui, inst.args[0], full=False, command=True)
324 else: 325 else:
325 ui.pager('help') 326 ui.pager('help')
326 ui.warn(_("hg: %s\n") % inst.args[1]) 327 ui.warn(_("hg: %s\n") % inst.args[1])
327 commands.help_(ui, 'shortlist') 328 commands.help_(ui, 'shortlist')