diff -r b9bef21cd214 -r bdb7ae65c27c mercurial/extensions.py --- a/mercurial/extensions.py Fri May 11 04:33:33 2012 -0500 +++ b/mercurial/extensions.py Fri May 11 14:00:51 2012 +0200 @@ -329,18 +329,19 @@ cmd = aliases[0] return (cmd, name, mod) + ext = None # first, search for an extension with the same name as the command path = paths.pop(cmd, None) if path: ext = findcmd(cmd, cmd, path) - if ext: - return ext - - # otherwise, interrogate each extension until there's a match - for name, path in paths.iteritems(): - ext = findcmd(cmd, name, path) - if ext: - return ext + if not ext: + # otherwise, interrogate each extension until there's a match + for name, path in paths.iteritems(): + ext = findcmd(cmd, name, path) + if ext: + break + if ext and 'DEPRECATED' not in ext.__doc__: + return ext raise error.UnknownCommand(cmd)