localrepo: simplify _updatebranchcache slightly
authorSune Foldager <cryo@cyanite.org>
Thu, 15 Apr 2010 17:25:37 +0200
changeset 10920 39c69b5dc258
parent 10919 435615a676b0
child 10922 fa1f5de99fb2
localrepo: simplify _updatebranchcache slightly
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Apr 15 15:35:06 2010 +0200
+++ b/mercurial/localrepo.py	Thu Apr 15 17:25:37 2010 +0200
@@ -411,9 +411,8 @@
         for branch, newnodes in newbranches.iteritems():
             bheads = partial.setdefault(branch, [])
             bheads.extend(newnodes)
-            if len(bheads) < 2:
+            if len(bheads) <= 1:
                 continue
-            newbheads = []
             # starting from tip means fewer passes over reachable
             while newnodes:
                 latest = newnodes.pop()
@@ -421,9 +420,8 @@
                     continue
                 minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
                 reachable = self.changelog.reachable(latest, minbhrev)
+                reachable.remove(latest)
                 bheads = [b for b in bheads if b not in reachable]
-                newbheads.insert(0, latest)
-            bheads.extend(newbheads)
             partial[branch] = bheads
 
     def lookup(self, key):