equal
deleted
inserted
replaced
2578 " debugindex debugindexdot paths") |
2578 " debugindex debugindexdot paths") |
2579 |
2579 |
2580 def find(cmd): |
2580 def find(cmd): |
2581 """Return (aliases, command table entry) for command string.""" |
2581 """Return (aliases, command table entry) for command string.""" |
2582 choice = None |
2582 choice = None |
|
2583 count = 0 |
2583 for e in table.keys(): |
2584 for e in table.keys(): |
2584 aliases = e.lstrip("^").split("|") |
2585 aliases = e.lstrip("^").split("|") |
2585 if cmd in aliases: |
2586 if cmd in aliases: |
2586 return aliases, table[e] |
2587 return aliases, table[e] |
2587 for a in aliases: |
2588 for a in aliases: |
2588 if a.startswith(cmd): |
2589 if a.startswith(cmd): |
2589 if choice: |
2590 count += 1 |
2590 raise AmbiguousCommand(cmd) |
2591 choice = aliases, table[e] |
2591 else: |
2592 break |
2592 choice = aliases, table[e] |
2593 |
2593 break |
2594 if count > 1: |
|
2595 raise AmbiguousCommand(cmd) |
|
2596 |
2594 if choice: |
2597 if choice: |
2595 return choice |
2598 return choice |
2596 |
2599 |
2597 raise UnknownCommand(cmd) |
2600 raise UnknownCommand(cmd) |
2598 |
2601 |