From patchwork Fri Mar 28 22:06:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6,of,9,V3] repoview: improve performance for computehidden From: Sean Farley X-Patchwork-Id: 4114 Message-Id: <71c5c07db06f3182d144.1396044364@laptop.local> To: mercurial-devel@selenic.com Date: Fri, 28 Mar 2014 17:06:04 -0500 # HG changeset patch # User Sean Farley # Date 1395969295 18000 # Thu Mar 27 20:14:55 2014 -0500 # Node ID 71c5c07db06f3182d144805a580816727acaab9a # Parent 2545603a2724a97dd78b17c207b188e9cef414a0 repoview: improve performance for computehidden 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 repo.localtags so as to avoid the tag cache. diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -33,12 +33,11 @@ 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')] + tags = [n for t, n in repo.localtags().iteritems()] blockers.extend(repo[t].rev() for t in tags) blocked = cl.ancestors(blockers, inclusive=True) return frozenset(r for r in hideable if r not in blocked) return frozenset()