equal
deleted
inserted
replaced
13 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") |
13 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") |
14 demandload(globals(), "errno socket version struct atexit sets bz2") |
14 demandload(globals(), "errno socket version struct atexit sets bz2") |
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] |
21 |
23 |
22 for t in filters: |
24 for t in filters: |
2380 if cmd in aliases: |
2382 if cmd in aliases: |
2381 return aliases, table[e] |
2383 return aliases, table[e] |
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: |
2389 return choice |
2391 return choice |
2390 |
2392 |
2503 help_(u, inst.args[0]) |
2505 help_(u, inst.args[0]) |
2504 else: |
2506 else: |
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') |
2511 sys.exit(1) |
2516 sys.exit(1) |
2512 |
2517 |