comparison mercurial/localrepo.py @ 9120:d3b995dd4eab

branch heads: optimise computation of branch head cache (issue1734) The previous branch heads cache implementation iterated all ancestors for each new revision in the repository, causing a massive slowdown on cloning larger repositories.
author Henrik Stuart <hg@hstuart.dk>
date Mon, 13 Jul 2009 20:19:17 +0200
parents 0b2b269ba3d0
children a5c060b80082 1444a42f6052
comparison
equal deleted inserted replaced
9118:78e54b9f3a62 9120:d3b995dd4eab
471 # starting from tip means fewer passes over reachable 471 # starting from tip means fewer passes over reachable
472 while newnodes: 472 while newnodes:
473 latest = newnodes.pop() 473 latest = newnodes.pop()
474 if latest not in bheads: 474 if latest not in bheads:
475 continue 475 continue
476 reachable = set() 476 minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
477 for bh in bheads: 477 reachable = self.changelog.reachable(latest, minbhrev)
478 reachable |= self.changelog.reachable(latest, bh)
479 bheads = [b for b in bheads if b not in reachable] 478 bheads = [b for b in bheads if b not in reachable]
480 newbheads.insert(0, latest) 479 newbheads.insert(0, latest)
481 bheads.extend(newbheads) 480 bheads.extend(newbheads)
482 partial[branch] = bheads 481 partial[branch] = bheads
483 482