Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 24222:02d7b5cd373b
dispatch: offer suggestions of similar-named commands
When suggestions are available, we show those suggestions instead of
showing some help output.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 10 Feb 2015 15:59:12 -0500 |
parents | 4bb348ae43cb |
children | 5ac8ce04baa2 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Jan 26 15:43:13 2015 -0500 +++ b/mercurial/cmdutil.py Tue Feb 10 15:59:12 2015 -0500 @@ -34,8 +34,10 @@ else: keys = table.keys() + allcmds = [] for e in keys: aliases = parsealiases(e) + allcmds.extend(aliases) found = None if cmd in aliases: found = cmd @@ -53,11 +55,11 @@ if not choice and debugchoice: choice = debugchoice - return choice + return choice, allcmds def findcmd(cmd, table, strict=True): """Return (aliases, command table entry) for command string.""" - choice = findpossible(cmd, table, strict) + choice, allcmds = findpossible(cmd, table, strict) if cmd in choice: return choice[cmd] @@ -70,7 +72,7 @@ if choice: return choice.values()[0] - raise error.UnknownCommand(cmd) + raise error.UnknownCommand(cmd, allcmds) def findrepo(p): while not os.path.isdir(os.path.join(p, ".hg")):