##// END OF EJS Templates
Improved error message for ambiguous command shortcuts.
Thomas Arendsen Hein -
r1518:ac4ca6bf default
parent child Browse files
Show More
@@ -15,6 +15,8 b' demandload(globals(), "errno socket vers'
15
15
16 class UnknownCommand(Exception):
16 class UnknownCommand(Exception):
17 """Exception raised if command is not in the command table."""
17 """Exception raised if command is not in the command table."""
18 class AmbiguousCommand(Exception):
19 """Exception raised if command shortcut matches more than one command."""
18
20
19 def filterfiles(filters, files):
21 def filterfiles(filters, files):
20 l = [x for x in files if x in filters]
22 l = [x for x in files if x in filters]
@@ -2382,7 +2384,7 b' def find(cmd):'
2382 for a in aliases:
2384 for a in aliases:
2383 if a.startswith(cmd):
2385 if a.startswith(cmd):
2384 if choice:
2386 if choice:
2385 raise UnknownCommand(cmd)
2387 raise AmbiguousCommand(cmd)
2386 else:
2388 else:
2387 choice = aliases, table[e]
2389 choice = aliases, table[e]
2388 if choice:
2390 if choice:
@@ -2505,6 +2507,9 b' def dispatch(args):'
2505 u.warn(_("hg: %s\n") % inst.args[1])
2507 u.warn(_("hg: %s\n") % inst.args[1])
2506 help_(u, 'shortlist')
2508 help_(u, 'shortlist')
2507 sys.exit(-1)
2509 sys.exit(-1)
2510 except AmbiguousCommand, inst:
2511 u.warn(_("hg: command '%s' is ambiguous.\n") % inst.args[0])
2512 sys.exit(1)
2508 except UnknownCommand, inst:
2513 except UnknownCommand, inst:
2509 u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
2514 u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
2510 help_(u, 'shortlist')
2515 help_(u, 'shortlist')
General Comments 0
You need to be logged in to leave comments. Login now