Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 45680:bb1a988ef4a5
errors: name arguments to UnknownCommand constructor
Differential Revision: https://phab.mercurial-scm.org/D9166
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 06 Oct 2020 21:06:18 -0700 |
parents | 65e2b64670b5 |
children | d2e1dcd4490d |
comparison
equal
deleted
inserted
replaced
45679:65e2b64670b5 | 45680:bb1a988ef4a5 |
---|---|
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: |
507 nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.args[0] | 507 nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command |
508 try: | 508 try: |
509 # check if the command is in a disabled extension | 509 # check if the command is in a disabled extension |
510 # (but don't check for extensions themselves) | 510 # (but don't check for extensions themselves) |
511 formatted = help.formattedhelp( | 511 formatted = help.formattedhelp( |
512 ui, commands, inst.args[0], unknowncmd=True | 512 ui, commands, inst.command, unknowncmd=True |
513 ) | 513 ) |
514 ui.warn(nocmdmsg) | 514 ui.warn(nocmdmsg) |
515 ui.write(formatted) | 515 ui.write(formatted) |
516 except (error.UnknownCommand, error.Abort): | 516 except (error.UnknownCommand, error.Abort): |
517 suggested = False | 517 suggested = False |
518 if len(inst.args) == 2: | 518 if inst.all_commands: |
519 sim = _getsimilar(inst.args[1], inst.args[0]) | 519 sim = _getsimilar(inst.all_commands, inst.command) |
520 if sim: | 520 if sim: |
521 ui.warn(nocmdmsg) | 521 ui.warn(nocmdmsg) |
522 _reportsimilar(ui.warn, sim) | 522 _reportsimilar(ui.warn, sim) |
523 suggested = True | 523 suggested = True |
524 if not suggested: | 524 if not suggested: |