mercurial/branchmap.py
changeset 20262 cf450ee3f8f7
parent 20261 3fee302a48e6
child 20263 ea4996754d91
equal deleted inserted replaced
20261:3fee302a48e6 20262:cf450ee3f8f7
   228         # collect new branch entries
   228         # collect new branch entries
   229         newbranches = {}
   229         newbranches = {}
   230         getbranchinfo = cl.branchinfo
   230         getbranchinfo = cl.branchinfo
   231         for r in revgen:
   231         for r in revgen:
   232             branch, closesbranch = getbranchinfo(r)
   232             branch, closesbranch = getbranchinfo(r)
   233             node = cl.node(r)
   233             newbranches.setdefault(branch, []).append(r)
   234             newbranches.setdefault(branch, []).append(node)
       
   235             if closesbranch:
   234             if closesbranch:
   236                 self._closednodes.add(node)
   235                 self._closednodes.add(cl.node(r))
   237         # if older branchheads are reachable from new ones, they aren't
   236         # if older branchheads are reachable from new ones, they aren't
   238         # really branchheads. Note checking parents is insufficient:
   237         # really branchheads. Note checking parents is insufficient:
   239         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   238         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   240         for branch, newnodes in newbranches.iteritems():
   239         for branch, newheadrevs in newbranches.iteritems():
   241             bheads = self.setdefault(branch, [])
   240             bheads = self.setdefault(branch, [])
   242             bheadrevs = [cl.rev(node) for node in bheads]
   241             bheadrevs = [cl.rev(node) for node in bheads]
   243             newheadrevs = [cl.rev(node) for node in newnodes]
       
   244             ctxisnew = bheadrevs and min(newheadrevs) > max(bheadrevs)
   242             ctxisnew = bheadrevs and min(newheadrevs) > max(bheadrevs)
   245             # Remove duplicates - nodes that are in newheadrevs and are already
   243             # Remove duplicates - nodes that are in newheadrevs and are already
   246             # in bheadrevs.  This can happen if you strip a node whose parent
   244             # in bheadrevs.  This can happen if you strip a node whose parent
   247             # was already a head (because they're on different branches).
   245             # was already a head (because they're on different branches).
   248             bheadrevs = sorted(set(bheadrevs).union(newheadrevs))
   246             bheadrevs = sorted(set(bheadrevs).union(newheadrevs))