--- a/mercurial/dispatch.py Wed Nov 18 16:47:20 2009 +0100
+++ b/mercurial/dispatch.py Wed Nov 18 17:09:00 2009 +0100
@@ -200,6 +200,12 @@
self.args = aliasargs(self.fn) + args
if cmd not in commands.norepo.split(' '):
self.norepo = False
+ if self.help.startswith("hg " + cmd):
+ # drop prefix in old-style help lines so hg shows the alias
+ self.help = self.help[4 + len(cmd):]
+ self.__doc__ = _("alias for: hg %s\n\n%s") \
+ % (definition, self.fn.__doc__)
+
except error.UnknownCommand:
def fn(ui, *args):
ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
@@ -240,14 +246,14 @@
if args:
cmd, args = args[0], args[1:]
- aliases, i = cmdutil.findcmd(cmd, commands.table,
+ aliases, entry = cmdutil.findcmd(cmd, commands.table,
ui.config("ui", "strict"))
cmd = aliases[0]
- args = aliasargs(i[0]) + args
+ args = aliasargs(entry[0]) + args
defaults = ui.config("defaults", cmd)
if defaults:
args = map(util.expandpath, shlex.split(defaults)) + args
- c = list(i[1])
+ c = list(entry[1])
else:
cmd = None
c = []
@@ -267,7 +273,7 @@
options[n] = cmdoptions[n]
del cmdoptions[n]
- return (cmd, cmd and i[0] or None, args, options, cmdoptions)
+ return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
def _parseconfig(ui, config):
"""parse the --config options from the command line"""