changeset 1506:11c8b81f95fe

if unambigious command name are passed, use them
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 04 Nov 2005 10:22:03 -0800
parents 27f08094cfe0
children cd8fadd8c689
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Nov 03 17:19:59 2005 -0800
+++ b/mercurial/commands.py	Fri Nov 04 10:22:03 2005 -0800
@@ -2374,9 +2374,17 @@
           " debugindex debugindexdot paths")
 
 def find(cmd):
+    choice = []
     for e in table.keys():
-        if re.match("(%s)$" % e, cmd):
+        aliases = e.lstrip("^").split("|")
+        if cmd in aliases:
             return e, table[e]
+        for a in aliases:
+            if a.startswith(cmd):
+                choice.append(e)
+    if len(choice) == 1:
+        e = choice[0]
+        return e, table[e]
 
     raise UnknownCommand(cmd)