alias: don't shadow commands that we only partially matched (issue2993) (BC)
authorAugie Fackler <durin42@gmail.com>
Tue, 11 Oct 2011 17:20:03 -0500
changeset 15233 81c97964d123
parent 15232 5d9a5b919863
child 15234 5d700b7edd85
alias: don't shadow commands that we only partially matched (issue2993) (BC) Previously, if you set an alias for "ci", it'd also shadow "commit" even though you didn't specify that. This occurred for all commands with explicit short variations.
mercurial/dispatch.py
tests/test-alias.t
--- a/mercurial/dispatch.py	Tue Oct 11 18:48:45 2011 +0200
+++ b/mercurial/dispatch.py	Tue Oct 11 17:20:03 2011 -0500
@@ -366,7 +366,7 @@
             # definition might not exist or it might not be a cmdalias
             pass
 
-        cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help)
+        cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
         if aliasdef.norepo:
             commands.norepo += ' %s' % alias
 
--- a/tests/test-alias.t	Tue Oct 11 18:48:45 2011 +0200
+++ b/tests/test-alias.t	Tue Oct 11 17:20:03 2011 -0500
@@ -4,6 +4,8 @@
   > graphlog=
   > 
   > [alias]
+  > # should clobber ci but not commit (issue2993)
+  > ci = version
   > myinit = init
   > cleanstatus = status -c
   > unknown = bargle
@@ -113,7 +115,7 @@
   no rollback information available
 
   $ echo foo > foo
-  $ hg ci -Amfoo
+  $ hg commit -Amfoo
   adding foo
 
 
@@ -195,7 +197,7 @@
   $ hg echo2 foo
   
   $ echo bar > bar
-  $ hg ci -qA -m bar
+  $ hg commit -qA -m bar
   $ hg count .
   1
   $ hg count 'branch(default)'