Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1743:813f9f5fe837
Merge with upstream
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sat, 18 Feb 2006 06:50:22 +0100 |
parents | 1e5bb6c929cd 57de7e1a81d2 |
children | 91c56c427171 |
comparison
equal
deleted
inserted
replaced
1742:1e5bb6c929cd | 1743:813f9f5fe837 |
---|---|
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 |