[PATCH 3 of 9 V3] localrepo: add _findlocaltags method

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


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396037258 18000
#      Fri Mar 28 15:07:38 2014 -0500
# Node ID ccf260976f55dd32cc8d5158d9f164c365275ee4
# Parent  50cf68685c17254b52aa0ebe4effeef3c65bd6a5
localrepo: add _findlocaltags method

This method will be used in future patches to allow access to only getting the
local tags. This will allow us to improve performance to avoid the cost of
building the tag cache for large repos with many heads.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -617,10 +617,23 @@ class localrepository(object):
 
         tags, tagtypes = self._encodetags(alltags, tagtypes)
         tags['tip'] = self.changelog.tip()
         return (tags, tagtypes)
 
+    def _findlocaltags(self):
+        '''Do the hard work of finding local tags.  Return a pair of dicts
+        (tags, tagtypes) where tags maps local tag name to node, and tagtypes
+        maps tag name to \'local\'.
+        Subclasses or extensions are free to add their own tags, but
+        should be aware that the returned dicts will be retained for the
+        duration of the localrepo object.'''
+        alltags = {}
+        tagtypes = {}
+
+        tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
+        return self._encodetags(alltags, tagtypes)
+
     def tagtype(self, tagname):
         '''
         return the type of the given tag. result can be:
 
         'local'  : a local tag


More information about the Mercurial-devel mailing list