[PATCH 2 of 2] alias: on --debug, print an alias's expansion when it has invalid arguments

Brodie Rao brodie at bitheap.org
Fri Aug 27 19:51:24 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1282956318 14400
# Node ID 9c207250692b14d062cdb59d2d8b0b2208354e5a
# Parent  5ca238f78619e001d9ce014d22efbaeda1696619
alias: on --debug, print an alias's expansion when it has invalid arguments

diff -r 5ca238f78619 -r 9c207250692b mercurial/dispatch.py
--- a/mercurial/dispatch.py	Fri Aug 27 20:45:11 2010 -0400
+++ b/mercurial/dispatch.py	Fri Aug 27 20:45:18 2010 -0400
@@ -293,7 +293,12 @@ class cmdalias(object):
         if self.definition.startswith('!'):
             return self.fn(ui, *args, **opts)
         else:
-            return util.checksignature(self.fn)(ui, *args, **opts)
+            try:
+                util.checksignature(self.fn)(ui, *args, **opts)
+            except error.SignatureError:
+                args = "%s %s" % (self.cmdname, ' '.join(self.args))
+                ui.debug(_("alias '%s' expands to '%s'\n") % (self.name, args))
+                raise
 
 def addaliases(ui, cmdtable):
     # aliases are processed after extensions have been loaded, so they


More information about the Mercurial-devel mailing list