Patchwork [1,of,3,V4] repoview: improve performance for computehidden (issue4206)

login
register
mail settings
Submitter Sean Farley
Date April 4, 2014, 1:22 a.m.
Message ID <9ffeca13668d408d5849.1396574548@laptop.local>
Download mbox | patch
Permalink /patch/4218/
State Accepted
Commit 388af5d4e90ce6ff97614c8835fa813015fda152
Headers show

Comments

Sean Farley - April 4, 2014, 1:22 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1395969295 18000
#      Thu Mar 27 20:14:55 2014 -0500
# Node ID 9ffeca13668d408d58490682492fc372603a2712
# Parent  70f9a5d8c06fa53cfbbc01593c35540dc7eb1380
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.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -8,10 +8,11 @@ 
 
 import copy
 import phases
 import util
 import obsolete
+import tags as tagsmod
 
 
 def hideablerevs(repo):
     """Revisions candidates to be hidden
 
@@ -33,13 +34,14 @@  def computehidden(repo):
         blockers = [r for r in tofilter if r not in hideable]
         for par in repo[None].parents():
             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()
 
 def computeunserved(repo):