Hide debug commands in ambiguous command list, unless no normal command matches.
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 07 Mar 2006 08:46:19 +0100
changeset 1850 05f6c0d1bad8
parent 1849 360d0f8d9d6f
child 1851 5c374776a8bc
Hide debug commands in ambiguous command list, unless no normal command matches. This will execute diff if 'hg d' is typed and hide rawcommit on 'hg r'. Based on a patch by TK Soh.
mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2679,15 +2679,22 @@ norepo = ("clone init version help debug
 def find(cmd):
     """Return (aliases, command table entry) for command string."""
     choice = []
+    debugchoice = []
     for e in table.keys():
         aliases = e.lstrip("^").split("|")
         if cmd in aliases:
             return aliases, table[e]
         for a in aliases:
             if a.startswith(cmd):
-                choice.append([aliases, table[e]])
+                if aliases[0].startswith("debug"):
+                    debugchoice.append([aliases, table[e]])
+                else:
+                    choice.append([aliases, table[e]])
                 break
 
+    if not choice and debugchoice:
+        choice = debugchoice
+
     if len(choice) > 1:
         clist = []
         for aliases, table_e in choice: