changeset 20261:3fee302a48e6

branchmap: stop membership test in update logic Now that no user try to update the cache on a truncated repo we can drop the extra lookup. Give an handfull percent speedup on big branchmap update.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 15 Jan 2013 20:04:12 +0100
parents 586ec8fe1c3c
children cf450ee3f8f7
files mercurial/branchmap.py
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Fri Jan 03 17:06:07 2014 -0800
+++ b/mercurial/branchmap.py	Tue Jan 15 20:04:12 2013 +0100
@@ -239,14 +239,8 @@
         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
         for branch, newnodes in newbranches.iteritems():
             bheads = self.setdefault(branch, [])
-            # Remove candidate heads that no longer are in the repo (e.g., as
-            # the result of a strip that just happened).  Avoid using 'node in
-            # self' here because that dives down into branchcache code somewhat
-            # recursively.
-            bheadrevs = [cl.rev(node) for node in bheads
-                         if cl.hasnode(node)]
-            newheadrevs = [cl.rev(node) for node in newnodes
-                           if cl.hasnode(node)]
+            bheadrevs = [cl.rev(node) for node in bheads]
+            newheadrevs = [cl.rev(node) for node in newnodes]
             ctxisnew = bheadrevs and min(newheadrevs) > max(bheadrevs)
             # Remove duplicates - nodes that are in newheadrevs and are already
             # in bheadrevs.  This can happen if you strip a node whose parent