Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1745:1dfc8e94108f
merge with crew.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 17 Feb 2006 21:56:15 -0800 |
parents | 813f9f5fe837 |
children | 91c56c427171 |
comparison
equal
deleted
inserted
replaced
1744:385b06493465 | 1745:1dfc8e94108f |
---|---|
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 |