Patchwork D804: alias: test duplicated definition earlier

login
register
mail settings
Submitter phabricator
Date Sept. 23, 2017, 9:41 p.m.
Message ID <2bfec366716ec2abaafc9e52b575e87f@localhost.localdomain>
Download mbox | patch
Permalink /patch/24123/
State Not Applicable
Headers show

Comments

phabricator - Sept. 23, 2017, 9:41 p.m.
quark updated this revision to Diff 2051.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D804?vs=2048&id=2051

REVISION DETAIL
  https://phab.mercurial-scm.org/D804

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -528,17 +528,15 @@ 
     # may use extension commands. Aliases can also use other alias definitions,
     # but only if they have been defined prior to the current definition.
     for alias, definition in ui.configitems('alias'):
-        source = ui.configsource('alias', alias)
-        aliasdef = cmdalias(alias, definition, cmdtable, source)
-
         try:
-            olddef = cmdtable[aliasdef.cmd][0]
-            if olddef.definition == aliasdef.definition:
+            if cmdtable[alias][0].definition == definition:
                 continue
         except (KeyError, AttributeError):
             # definition might not exist or it might not be a cmdalias
             pass
 
+        source = ui.configsource('alias', alias)
+        aliasdef = cmdalias(alias, definition, cmdtable, source)
         cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
 
 def _parse(ui, args):