[PATCH 4 of 9 V3] localrepo: use _findlocaltags in _findtags

Sean Farley sean.michael.farley at gmail.com
Fri Mar 28 17:06:02 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1395964989 18000
#      Thu Mar 27 19:03:09 2014 -0500
# Node ID ee90b9a274e93bf091e9c00f9bfc916eb98e2408
# Parent  ccf260976f55dd32cc8d5158d9f164c365275ee4
localrepo: use _findlocaltags in _findtags

This makes the only caller of tags.readlocaltags localrepo._findlocaltags now.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -611,13 +611,21 @@ class localrepository(object):
 
         alltags = {}                    # map tag name to (node, hist)
         tagtypes = {}
 
         tagsmod.findglobaltags(self.ui, self, alltags, tagtypes)
-        tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
+        tags, tagtypes = self._encodetags(alltags, tagtypes)
 
-        tags, tagtypes = self._encodetags(alltags, tagtypes)
+        ltags, ltagtypes = self._findlocaltags()
+        # global tags take precedence, so we only update distinct local tags
+        ltags = dict([(name, node) for name, node in ltags.iteritems()
+                      if name not in tags])
+        ltagtypes = dict([(name, type) for name, type in ltagtypes.iteritems()
+                          if name not in tagtypes])
+        tags.update(ltags)
+        tagtypes.update(ltagtypes)
+
         tags['tip'] = self.changelog.tip()
         return (tags, tagtypes)
 
     def _findlocaltags(self):
         '''Do the hard work of finding local tags.  Return a pair of dicts


More information about the Mercurial-devel mailing list