diff mercurial/commands.py @ 2049:f70952384ae7

Make completion for debugindex<tab><tab> show debugindexdot, too. The special handling for commands with names that are substrings of other commands (e.g. with st and strip) wasn't used with debug commands before.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 05 Apr 2006 19:07:50 +0200
parents 5796edb127e6
children 1f6d520557ec 345107e167a0
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Apr 05 15:39:48 2006 +0200
+++ b/mercurial/commands.py	Wed Apr 05 19:07:50 2006 +0200
@@ -3154,22 +3154,26 @@
 def findpossible(cmd):
     """
     Return cmd -> (aliases, command table entry)
-    for each matching command
+    for each matching command.
+    Return debug commands (or their aliases) only if no normal command matches.
     """
     choice = {}
     debugchoice = {}
     for e in table.keys():
         aliases = e.lstrip("^").split("|")
+        found = None
         if cmd in aliases:
-            choice[cmd] = (aliases, table[e])
-            continue
-        for a in aliases:
-            if a.startswith(cmd):
-                if aliases[0].startswith("debug"):
-                    debugchoice[a] = (aliases, table[e])
-                else:
-                    choice[a] = (aliases, table[e])
-                break
+            found = cmd
+        else:
+            for a in aliases:
+                if a.startswith(cmd):
+                    found = a
+                    break
+        if found is not None:
+            if aliases[0].startswith("debug"):
+                debugchoice[found] = (aliases, table[e])
+            else:
+                choice[found] = (aliases, table[e])
 
     if not choice and debugchoice:
         choice = debugchoice