changeset 11351:1cdc8b5e5729

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.
author Greg Ward <greg-hg@gerg.ca>
date Tue, 15 Jun 2010 15:02:54 -0400
parents 5ea28187707e
children b19067ee4507
files mercurial/tags.py
diffstat 1 files changed, 5 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tags.py	Tue Jun 15 17:15:31 2010 +0200
+++ b/mercurial/tags.py	Tue Jun 15 15:02:54 2010 -0400
@@ -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: