##// END OF EJS Templates
phases: improve performance of _retractboundary...
Joerg Sonnenberger -
r45511:ae6890f1 default draft
parent child Browse files
Show More
@@ -583,30 +583,28 b' class phasecache(object):'
583 raise error.ProgrammingError(msg)
583 raise error.ProgrammingError(msg)
584
584
585 repo = repo.unfiltered()
585 repo = repo.unfiltered()
586 currentroots = self.phaseroots[targetphase]
586 torev = repo.changelog.rev
587 tonode = repo.changelog.node
588 currentroots = {torev(node) for node in self.phaseroots[targetphase]}
587 finalroots = oldroots = set(currentroots)
589 finalroots = oldroots = set(currentroots)
588 newroots = [
590 newroots = [torev(node) for node in nodes]
589 n for n in nodes if self.phase(repo, repo[n].rev()) < targetphase
591 newroots = [rev for rev in newroots if self.phase(repo, rev) < targetphase]
590 ]
592
591 if newroots:
593 if newroots:
592
594 if nullrev in newroots:
593 if nullid in newroots:
594 raise error.Abort(_(b'cannot change null revision phase'))
595 raise error.Abort(_(b'cannot change null revision phase'))
595 currentroots = currentroots.copy()
596 currentroots.update(newroots)
596 currentroots.update(newroots)
597
597
598 # Only compute new roots for revs above the roots that are being
598 # Only compute new roots for revs above the roots that are being
599 # retracted.
599 # retracted.
600 minnewroot = min(repo[n].rev() for n in newroots)
600 minnewroot = min(newroots)
601 aboveroots = [
601 aboveroots = [rev for rev in currentroots if rev >= minnewroot]
602 n for n in currentroots if repo[n].rev() >= minnewroot
602 updatedroots = repo.set(b'roots(%ld::)', aboveroots)
603 ]
604 updatedroots = repo.set(b'roots(%ln::)', aboveroots)
605
603
606 finalroots = {n for n in currentroots if repo[n].rev() < minnewroot}
604 finalroots = {rev for rev in currentroots if rev < minnewroot}
607 finalroots.update(ctx.node() for ctx in updatedroots)
605 finalroots.update(ctx.rev() for ctx in updatedroots)
608 if finalroots != oldroots:
606 if finalroots != oldroots:
609 self._updateroots(targetphase, finalroots, tr)
607 self._updateroots(targetphase, {tonode(rev) for rev in finalroots}, tr)
610 return True
608 return True
611 return False
609 return False
612
610
General Comments 0
You need to be logged in to leave comments. Login now