mercurial/localrepo.py
changeset 14056 bcfe78c3d15c
parent 14048 58e58406ed19
child 14064 e4bfb9c337f3
--- a/mercurial/localrepo.py	Sat Apr 30 12:55:07 2011 +0200
+++ b/mercurial/localrepo.py	Sat Apr 30 12:56:28 2011 +0200
@@ -509,15 +509,17 @@
             bheads.extend(newnodes)
             if len(bheads) <= 1:
                 continue
+            bheads = sorted(bheads, key=lambda x: self[x].rev())
             # starting from tip means fewer passes over reachable
             while newnodes:
                 latest = newnodes.pop()
                 if latest not in bheads:
                     continue
-                minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
+                minbhrev = self[bheads[0]].node()
                 reachable = self.changelog.reachable(latest, minbhrev)
                 reachable.remove(latest)
-                bheads = [b for b in bheads if b not in reachable]
+                if reachable:
+                    bheads = [b for b in bheads if b not in reachable]
             partial[branch] = bheads
 
     def lookup(self, key):