equal
deleted
inserted
replaced
2546 " debugindex debugindexdot paths") |
2546 " debugindex debugindexdot paths") |
2547 |
2547 |
2548 def find(cmd): |
2548 def find(cmd): |
2549 """Return (aliases, command table entry) for command string.""" |
2549 """Return (aliases, command table entry) for command string.""" |
2550 choice = None |
2550 choice = None |
|
2551 count = 0 |
2551 for e in table.keys(): |
2552 for e in table.keys(): |
2552 aliases = e.lstrip("^").split("|") |
2553 aliases = e.lstrip("^").split("|") |
2553 if cmd in aliases: |
2554 if cmd in aliases: |
2554 return aliases, table[e] |
2555 return aliases, table[e] |
2555 for a in aliases: |
2556 for a in aliases: |
2556 if a.startswith(cmd): |
2557 if a.startswith(cmd): |
2557 if choice: |
2558 count += 1 |
2558 raise AmbiguousCommand(cmd) |
2559 choice = aliases, table[e] |
2559 else: |
2560 break |
2560 choice = aliases, table[e] |
2561 |
2561 break |
2562 if count > 1: |
|
2563 raise AmbiguousCommand(cmd) |
|
2564 |
2562 if choice: |
2565 if choice: |
2563 return choice |
2566 return choice |
2564 |
2567 |
2565 raise UnknownCommand(cmd) |
2568 raise UnknownCommand(cmd) |
2566 |
2569 |