Show More
@@ -504,19 +504,19 b' def _callcatch(ui, func):' | |||||
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. |
|
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. |
|
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 |
|
518 | if inst.all_commands: | |
519 |
sim = _getsimilar(inst.a |
|
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) |
@@ -111,6 +111,11 b' class CommandError(Exception):' | |||||
111 | class UnknownCommand(Exception): |
|
111 | class UnknownCommand(Exception): | |
112 | """Exception raised if command is not in the command table.""" |
|
112 | """Exception raised if command is not in the command table.""" | |
113 |
|
113 | |||
|
114 | def __init__(self, command, all_commands=None): | |||
|
115 | self.command = command | |||
|
116 | self.all_commands = all_commands | |||
|
117 | super(UnknownCommand, self).__init__() | |||
|
118 | ||||
114 | __bytes__ = _tobytes |
|
119 | __bytes__ = _tobytes | |
115 |
|
120 | |||
116 |
|
121 |
General Comments 0
You need to be logged in to leave comments.
Login now