##// END OF EJS Templates
localrepo: convert _updatebranchcache from nodespace to revspace...
Joshua Redstone -
r17012:ea97744c default
parent child Browse files
Show More
@@ -574,29 +574,26 b' class localrepository(repo.repository):'
574 # collect new branch entries
574 # collect new branch entries
575 newbranches = {}
575 newbranches = {}
576 for c in ctxgen:
576 for c in ctxgen:
577 newbranches.setdefault(c.branch(), []).append(c.node())
577 newbranches.setdefault(c.branch(), []).append(c.rev())
578 # if older branchheads are reachable from new ones, they aren't
578 # if older branchheads are reachable from new ones, they aren't
579 # really branchheads. Note checking parents is insufficient:
579 # really branchheads. Note checking parents is insufficient:
580 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
580 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
581 for branch, newnodes in newbranches.iteritems():
581 for branch, newrevs in newbranches.iteritems():
582 bheads = partial.setdefault(branch, [])
582 bheadrevs = [self.changelog.rev(node) for node in
583 bheads.extend(newnodes)
583 partial.setdefault(branch, [])]
584 if len(bheads) <= 1:
584 bheadrevs.extend(newrevs)
585 continue
585 bheadrevs.sort()
586 bheads = sorted(bheads, key=lambda x: self[x].rev())
586 # starting from tip means fewer passes over ancestors
587 # starting from tip means fewer passes over reachable
587 newrevs.sort()
588 while newnodes:
588 while newrevs:
589 latest = newnodes.pop()
589 latest = newrevs.pop()
590 if latest not in bheads:
590 if latest not in bheadrevs:
591 continue
591 continue
592 minbhnode = self[bheads[0]].node()
592 ancestors = set(self.changelog.ancestors([latest],
593 cl = self.changelog
593 bheadrevs[0]))
594 ancestors = cl.ancestors([cl.rev(latest)],
594 if ancestors:
595 cl.rev(minbhnode))
595 bheadrevs = [b for b in bheadrevs if b not in ancestors]
596 reachable = [cl.node(rev) for rev in ancestors]
596 partial[branch] = [self.changelog.node(rev) for rev in bheadrevs]
597 if reachable:
598 bheads = [b for b in bheads if b not in reachable]
599 partial[branch] = bheads
600
597
601 def lookup(self, key):
598 def lookup(self, key):
602 return self[key].node()
599 return self[key].node()
General Comments 0
You need to be logged in to leave comments. Login now