Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 45678:bd2df58366b1
errors: name arguments to CommandError constructor
Because readability counts.
Differential Revision: https://phab.mercurial-scm.org/D9164
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 06 Oct 2020 20:37:35 -0700 |
parents | 9b5723784aac |
children | 65e2b64670b5 |
comparison
equal
deleted
inserted
replaced
45677:bdd2cdf9e248 | 45678:bd2df58366b1 |
---|---|
490 ui.warn( | 490 ui.warn( |
491 _(b"hg: command '%s' is ambiguous:\n %s\n") | 491 _(b"hg: command '%s' is ambiguous:\n %s\n") |
492 % (inst.args[0], b" ".join(inst.args[1])) | 492 % (inst.args[0], b" ".join(inst.args[1])) |
493 ) | 493 ) |
494 except error.CommandError as inst: | 494 except error.CommandError as inst: |
495 if inst.args[0]: | 495 if inst.command: |
496 ui.pager(b'help') | 496 ui.pager(b'help') |
497 msgbytes = pycompat.bytestr(inst.args[1]) | 497 msgbytes = pycompat.bytestr(inst.message) |
498 ui.warn(_(b"hg %s: %s\n") % (inst.args[0], msgbytes)) | 498 ui.warn(_(b"hg %s: %s\n") % (inst.command, msgbytes)) |
499 commands.help_(ui, inst.args[0], full=False, command=True) | 499 commands.help_(ui, inst.command, full=False, command=True) |
500 else: | 500 else: |
501 ui.warn(_(b"hg: %s\n") % inst.args[1]) | 501 ui.warn(_(b"hg: %s\n") % inst.message) |
502 ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) | 502 ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) |
503 except error.ParseError as inst: | 503 except error.ParseError as inst: |
504 _formatparse(ui.warn, inst) | 504 _formatparse(ui.warn, inst) |
505 return -1 | 505 return -1 |
506 except error.UnknownCommand as inst: | 506 except error.UnknownCommand as inst: |