##// END OF EJS Templates
AmbiguousCommand is raised too soon....
Alexis S. L. Carvalho -
r1739:57de7e1a default
parent child Browse files
Show More
@@ -2548,17 +2548,20 b' norepo = ("clone init version help debug'
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
General Comments 0
You need to be logged in to leave comments. Login now