Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1850:05f6c0d1bad8
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.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 07 Mar 2006 08:46:19 +0100 |
parents | 360d0f8d9d6f |
children | 5c374776a8bc |
comparison
equal
deleted
inserted
replaced
1849:360d0f8d9d6f | 1850:05f6c0d1bad8 |
---|---|
2677 " debugindex debugindexdot paths") | 2677 " debugindex debugindexdot paths") |
2678 | 2678 |
2679 def find(cmd): | 2679 def find(cmd): |
2680 """Return (aliases, command table entry) for command string.""" | 2680 """Return (aliases, command table entry) for command string.""" |
2681 choice = [] | 2681 choice = [] |
2682 debugchoice = [] | |
2682 for e in table.keys(): | 2683 for e in table.keys(): |
2683 aliases = e.lstrip("^").split("|") | 2684 aliases = e.lstrip("^").split("|") |
2684 if cmd in aliases: | 2685 if cmd in aliases: |
2685 return aliases, table[e] | 2686 return aliases, table[e] |
2686 for a in aliases: | 2687 for a in aliases: |
2687 if a.startswith(cmd): | 2688 if a.startswith(cmd): |
2688 choice.append([aliases, table[e]]) | 2689 if aliases[0].startswith("debug"): |
2690 debugchoice.append([aliases, table[e]]) | |
2691 else: | |
2692 choice.append([aliases, table[e]]) | |
2689 break | 2693 break |
2694 | |
2695 if not choice and debugchoice: | |
2696 choice = debugchoice | |
2690 | 2697 |
2691 if len(choice) > 1: | 2698 if len(choice) > 1: |
2692 clist = [] | 2699 clist = [] |
2693 for aliases, table_e in choice: | 2700 for aliases, table_e in choice: |
2694 if aliases[0].startswith(cmd): | 2701 if aliases[0].startswith(cmd): |