diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -183,7 +183,9 @@ The tags cache is read and updated as a side-effect of calling. """ - (heads, tagfnode, valid, cachetags, shouldwrite) = _readtagcache(ui, repo) + (heads, tagfnode, valid, cachetags, shouldwrite, source) = _readtagcache( + ui, repo + ) if cachetags is not None: assert not shouldwrite # XXX is this really 100% correct? are there oddball special @@ -392,7 +394,7 @@ def _readtagcache(ui, repo): """Read the tag cache. - Returns a tuple (heads, fnodes, validinfo, cachetags, shouldwrite). + Returns a tuple (heads, fnodes, validinfo, cachetags, shouldwrite, source). If the cache is completely up-to-date, "cachetags" is a dict of the form returned by _readtags() and "heads", "fnodes", and "validinfo" are @@ -404,6 +406,12 @@ when writing the tags cache. "fnodes" is a mapping from head to .hgtags filenode. "shouldwrite" is True. + "source" is from which cache the data is read. Possible values are: + tags2: when data is read from `tags2-` cache + hgtagsfnodes: data is read from hgtagsfnodes cache + other: when data is read from source other than tags2 and + hgtagsfnodes cache + If the cache is not up to date, the caller is responsible for reading tag info from each returned head. (See findglobaltags().) """ @@ -443,7 +451,7 @@ ): tags = _readtags(ui, repo, cachelines, cachefile.name) cachefile.close() - return (None, None, None, tags, False) + return (None, None, None, tags, False, 'tags2') if cachefile: cachefile.close() # ignore rest of file @@ -453,7 +461,7 @@ # Case 2 (uncommon): empty repo; get out quickly and don't bother # writing an empty cache. if repoheads == [nullid]: - return ([], {}, valid, {}, False) + return ([], {}, valid, {}, False, 'other') # Case 3 (uncommon): cache file missing or empty. @@ -471,7 +479,7 @@ if not len(repo.file(b'.hgtags')): # No tags have ever been committed, so we can avoid a # potentially expensive search. - return ([], {}, valid, None, True) + return ([], {}, valid, None, True, 'other') # Now we have to lookup the .hgtags filenode for every new head. # This is the most expensive part of finding tags, so performance @@ -482,7 +490,7 @@ # Caller has to iterate over all heads, but can use the filenodes in # cachefnode to get to each .hgtags revision quickly. - return (repoheads, cachefnode, valid, None, True) + return (repoheads, cachefnode, valid, None, True, 'hgtagsfnodes') def _getfnodes(ui, repo, nodes):