Mercurial > hg > mercurial-crew
diff mercurial/tags.py @ 24916:b061a2049662
tags: have a different cache file per filter level
Currently whichever filter level asks for tags last will write the data on disk.
This create massive issues when tags are read for "visible" and "unfiltered"
on large and multi headed repository (like Mozilla central). See issue4550 for
details
Each filter level recomputes its own cache without direct collaboration but they
all share the same 'hgtagsfnodes' cache. And that is where most of the time is
spent.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 15 Apr 2015 18:34:34 -0400 |
parents | 07200e3332a1 |
children | d082c6ef9ec3 |
line wrap: on
line diff
--- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -246,6 +246,13 @@ ahist.extend([n for n in bhist if n not in ahist]) alltags[name] = anode, ahist +def _filename(repo): + """name of a tagcache file for a given repo or repoview""" + filename = 'cache/tags' + if repo.filtername: + filename = '%s-%s' % (filename, repo.filtername) + return filename + def _readtagcache(ui, repo): '''Read the tag cache. @@ -265,7 +272,7 @@ ''' try: - cachefile = repo.vfs('cache/tags', 'r') + cachefile = repo.vfs(_filename(repo), 'r') # force reading the file for static-http cachelines = iter(cachefile) except IOError: @@ -360,7 +367,7 @@ def _writetagcache(ui, repo, heads, tagfnode, cachetags): try: - cachefile = repo.vfs('cache/tags', 'w', atomictemp=True) + cachefile = repo.vfs(_filename(repo), 'w', atomictemp=True) except (OSError, IOError): return