##// END OF EJS Templates
Branch heads should not include "heads" that are ancestors of other heads....
Brendan Cully -
r8954:e67e5b60 default
parent child Browse files
Show More
@@ -454,15 +454,30 b' class localrepository(repo.repository):'
454 pass
454 pass
455
455
456 def _updatebranchcache(self, partial, start, end):
456 def _updatebranchcache(self, partial, start, end):
457 # collect new branch entries
458 newbranches = {}
457 for r in xrange(start, end):
459 for r in xrange(start, end):
458 c = self[r]
460 c = self[r]
459 b = c.branch()
461 newbranches.setdefault(c.branch(), []).append(c.node())
460 bheads = partial.setdefault(b, [])
462 # if older branchheads are reachable from new ones, they aren't
461 bheads.append(c.node())
463 # really branchheads. Note checking parents is insufficient:
462 for p in c.parents():
464 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
463 pn = p.node()
465 for branch, newnodes in newbranches.iteritems():
464 if pn in bheads:
466 bheads = partial.setdefault(branch, [])
465 bheads.remove(pn)
467 bheads.extend(newnodes)
468 if len(bheads) < 2:
469 continue
470 newbheads = []
471 # starting from tip means fewer passes over reachable
472 while newnodes:
473 latest = newnodes.pop()
474 if latest not in bheads:
475 continue
476 reachable = self.changelog.reachable(latest, bheads[0])
477 bheads = [b for b in bheads if b not in reachable]
478 newbheads.insert(0, latest)
479 bheads.extend(newbheads)
480 partial[branch] = bheads
466
481
467 def lookup(self, key):
482 def lookup(self, key):
468 if isinstance(key, int):
483 if isinstance(key, int):
@@ -19,6 +19,9 b' hg branch default'
19 hg branch -f default
19 hg branch -f default
20 hg ci -m "clear branch name" -d "1000000 0"
20 hg ci -m "clear branch name" -d "1000000 0"
21
21
22 echo % there should be only one default branch head
23 hg heads .
24
22 hg co foo
25 hg co foo
23 hg branch
26 hg branch
24 echo bleah > a
27 echo bleah > a
General Comments 0
You need to be logged in to leave comments. Login now