Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
2048:8f9660c568b8 | 2049:f70952384ae7 |
---|---|
3152 optionalrepo = ("paths debugconfig") | 3152 optionalrepo = ("paths debugconfig") |
3153 | 3153 |
3154 def findpossible(cmd): | 3154 def findpossible(cmd): |
3155 """ | 3155 """ |
3156 Return cmd -> (aliases, command table entry) | 3156 Return cmd -> (aliases, command table entry) |
3157 for each matching command | 3157 for each matching command. |
3158 Return debug commands (or their aliases) only if no normal command matches. | |
3158 """ | 3159 """ |
3159 choice = {} | 3160 choice = {} |
3160 debugchoice = {} | 3161 debugchoice = {} |
3161 for e in table.keys(): | 3162 for e in table.keys(): |
3162 aliases = e.lstrip("^").split("|") | 3163 aliases = e.lstrip("^").split("|") |
3164 found = None | |
3163 if cmd in aliases: | 3165 if cmd in aliases: |
3164 choice[cmd] = (aliases, table[e]) | 3166 found = cmd |
3165 continue | 3167 else: |
3166 for a in aliases: | 3168 for a in aliases: |
3167 if a.startswith(cmd): | 3169 if a.startswith(cmd): |
3168 if aliases[0].startswith("debug"): | 3170 found = a |
3169 debugchoice[a] = (aliases, table[e]) | 3171 break |
3170 else: | 3172 if found is not None: |
3171 choice[a] = (aliases, table[e]) | 3173 if aliases[0].startswith("debug"): |
3172 break | 3174 debugchoice[found] = (aliases, table[e]) |
3175 else: | |
3176 choice[found] = (aliases, table[e]) | |
3173 | 3177 |
3174 if not choice and debugchoice: | 3178 if not choice and debugchoice: |
3175 choice = debugchoice | 3179 choice = debugchoice |
3176 | 3180 |
3177 return choice | 3181 return choice |