repoview: improve performance for computehidden (
issue4206)
For repos with a large number of heads (including hidden heads), a stale tag
cache would cause computehidden to be drastically slower because of a the call
to repo.tags() (which would build the tag cache).
We actually don't need the tag cache for computehidden because we filter out
global tags. This patch replaces the call to repo.tags with readlocaltags so
as to avoid the tag cache.
--- a/mercurial/repoview.py Sat Mar 15 18:27:51 2014 +0100
+++ b/mercurial/repoview.py Thu Mar 27 20:14:55 2014 -0500
@@ -10,6 +10,7 @@
import phases
import util
import obsolete
+import tags as tagsmod
def hideablerevs(repo):
@@ -35,9 +36,10 @@
blockers.append(par.rev())
for bm in repo._bookmarks.values():
blockers.append(repo[bm].rev())
- tags = [n for t, n in repo.tags().iteritems()
- if (repo.tagtype(t) and repo.tagtype(t) != 'global')]
- blockers.extend(repo[t].rev() for t in tags)
+ tags = {}
+ tagsmod.readlocaltags(repo.ui, repo, tags, {})
+ if tags:
+ blockers.extend(repo[t[0]].rev() for t in tags.values())
blocked = cl.ancestors(blockers, inclusive=True)
return frozenset(r for r in hideable if r not in blocked)
return frozenset()