[PATCH 1 of 2] alias: print what command is being shadowed in debug message

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


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1282956311 14400
# Node ID 5ca238f78619e001d9ce014d22efbaeda1696619
# Parent  6449be7b8a3b96f06e7376f983035efcb189c30e
alias: print what command is being shadowed in debug message

diff -r 6449be7b8a3b -r 5ca238f78619 mercurial/dispatch.py
--- a/mercurial/dispatch.py	Wed Aug 25 23:26:18 2010 +0100
+++ b/mercurial/dispatch.py	Fri Aug 27 20:45:11 2010 -0400
@@ -190,6 +190,7 @@ def aliasargs(fn):
 class cmdalias(object):
     def __init__(self, name, definition, cmdtable):
         self.name = self.cmd = name
+        self.cmdname = ''
         self.definition = definition
         self.args = []
         self.opts = []
@@ -234,7 +235,7 @@ class cmdalias(object):
             return
 
         args = shlex.split(self.definition)
-        cmd = args.pop(0)
+        self.cmdname = cmd = args.pop(0)
         args = map(util.expandpath, args)
 
         for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
@@ -286,7 +287,8 @@ class cmdalias(object):
 
     def __call__(self, ui, *args, **opts):
         if self.shadows:
-            ui.debug("alias '%s' shadows command\n" % self.name)
+            ui.debug("alias '%s' shadows command '%s'\n" %
+                     (self.name, self.cmdname))
 
         if self.definition.startswith('!'):
             return self.fn(ui, *args, **opts)


More information about the Mercurial-devel mailing list