Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 7213:b4c035057d34
findcmd: have dispatch look up strict flag
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 22 Oct 2008 17:34:08 -0500 |
parents | b801d6e5dc83 |
children | 810ca383da9c |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Oct 22 17:00:05 2008 -0500 +++ b/mercurial/cmdutil.py Wed Oct 22 17:34:08 2008 -0500 @@ -18,7 +18,7 @@ class AmbiguousCommand(Exception): """Exception raised if command shortcut matches more than one command.""" -def findpossible(ui, cmd, table): +def findpossible(cmd, table, strict=False): """ Return cmd -> (aliases, command table entry) for each matching command. @@ -31,7 +31,7 @@ found = None if cmd in aliases: found = cmd - elif not ui.config("ui", "strict"): + elif not strict: for a in aliases: if a.startswith(cmd): found = a @@ -47,9 +47,9 @@ return choice -def findcmd(ui, cmd, table): +def findcmd(cmd, table, strict=True): """Return (aliases, command table entry) for command string.""" - choice = findpossible(ui, cmd, table) + choice = findpossible(cmd, table, strict) if cmd in choice: return choice[cmd]