[PATCH] tags: remove the old non-caching implementation of findglobaltags()

Greg Ward greg-hg at gerg.ca
Tue Jun 15 14:04:44 CDT 2010


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1276628574 14400
# Node ID f46793296ccd07f765f45f9a975c42845631f13a
# Parent  ad0a334eef163df857c36fdca2bd4daadba9df99
tags: remove the old non-caching implementation of findglobaltags().

It was left behind just in case the tag cache blew up in Mercurial
1.4, so we could easily revert to the non-caching code.  There have
been no problems with the tag cache in 1.4 or 1.5, so it should be
safe to get rid of this code now.

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -27,37 +27,12 @@
 _debug = _debugalways
 _debug = _debugnever
 
-def findglobaltags1(ui, repo, alltags, tagtypes):
+def findglobaltags(ui, repo, alltags, tagtypes):
     '''Find global tags in repo by reading .hgtags from every head that
-    has a distinct version of it.  Updates the dicts alltags, tagtypes
-    in place: alltags maps tag name to (node, hist) pair (see _readtags()
-    below), and tagtypes maps tag name to tag type ('global' in this
-    case).'''
-
-    seen = set()
-    fctx = None
-    ctxs = []                       # list of filectx
-    for node in repo.heads():
-        try:
-            fnode = repo[node].filenode('.hgtags')
-        except error.LookupError:
-            continue
-        if fnode not in seen:
-            seen.add(fnode)
-            if not fctx:
-                fctx = repo.filectx('.hgtags', fileid=fnode)
-            else:
-                fctx = fctx.filectx(fnode)
-            ctxs.append(fctx)
-
-    # read the tags file from each head, ending with the tip
-    for fctx in reversed(ctxs):
-        filetags = _readtags(
-            ui, repo, fctx.data().splitlines(), fctx)
-        _updatetags(filetags, "global", alltags, tagtypes)
-
-def findglobaltags2(ui, repo, alltags, tagtypes):
-    '''Same as findglobaltags1(), but with caching.'''
+    has a distinct version of it, using a cache to avoid excess work.
+    Updates the dicts alltags, tagtypes in place: alltags maps tag name
+    to (node, hist) pair (see _readtags() below), and tagtypes maps tag
+    name to tag type ("global" in this case).'''
     # This is so we can be lazy and assume alltags contains only global
     # tags when we pass it to _writetagcache().
     assert len(alltags) == len(tagtypes) == 0, \
@@ -95,9 +70,6 @@
     if shouldwrite:
         _writetagcache(ui, repo, heads, tagfnode, alltags)
 
-# Set this to findglobaltags1 to disable tag caching.
-findglobaltags = findglobaltags2
-
 def readlocaltags(ui, repo, alltags, tagtypes):
     '''Read local tags in repo.  Update alltags and tagtypes.'''
     try:


More information about the Mercurial-devel mailing list