# HG changeset patch # User Pierre-Yves David # Date 2013-01-15 19:04:12 # Node ID 3fee302a48e69017579cea6b7cdca5c95114d24a # Parent 586ec8fe1c3c9574bca6a43cff2546c14c0f4d3c 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. diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -239,14 +239,8 @@ class branchcache(dict): # 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