mercurial/localrepo.py
changeset 10920 39c69b5dc258
parent 10912 3d7c20986027
child 10926 4d81cbd8a851
equal deleted inserted replaced
10919:435615a676b0 10920:39c69b5dc258
   409         # really branchheads. Note checking parents is insufficient:
   409         # really branchheads. Note checking parents is insufficient:
   410         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   410         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   411         for branch, newnodes in newbranches.iteritems():
   411         for branch, newnodes in newbranches.iteritems():
   412             bheads = partial.setdefault(branch, [])
   412             bheads = partial.setdefault(branch, [])
   413             bheads.extend(newnodes)
   413             bheads.extend(newnodes)
   414             if len(bheads) < 2:
   414             if len(bheads) <= 1:
   415                 continue
   415                 continue
   416             newbheads = []
       
   417             # starting from tip means fewer passes over reachable
   416             # starting from tip means fewer passes over reachable
   418             while newnodes:
   417             while newnodes:
   419                 latest = newnodes.pop()
   418                 latest = newnodes.pop()
   420                 if latest not in bheads:
   419                 if latest not in bheads:
   421                     continue
   420                     continue
   422                 minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
   421                 minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
   423                 reachable = self.changelog.reachable(latest, minbhrev)
   422                 reachable = self.changelog.reachable(latest, minbhrev)
       
   423                 reachable.remove(latest)
   424                 bheads = [b for b in bheads if b not in reachable]
   424                 bheads = [b for b in bheads if b not in reachable]
   425                 newbheads.insert(0, latest)
       
   426             bheads.extend(newbheads)
       
   427             partial[branch] = bheads
   425             partial[branch] = bheads
   428 
   426 
   429     def lookup(self, key):
   427     def lookup(self, key):
   430         if isinstance(key, int):
   428         if isinstance(key, int):
   431             return self.changelog.node(key)
   429             return self.changelog.node(key)