[Updated] D8641: phases: improve performance of _retractboundary
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Fri Jun 19 11:55:50 UTC 2020
Closed by commit rHGae6890f108f2: phases: improve performance of _retractboundary (authored by joerg.sonnenberger).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8641?vs=21664&id=21667
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8641/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8641
AFFECTED FILES
mercurial/phases.py
CHANGE DETAILS
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -583,30 +583,28 @@
raise error.ProgrammingError(msg)
repo = repo.unfiltered()
- currentroots = self.phaseroots[targetphase]
+ torev = repo.changelog.rev
+ tonode = repo.changelog.node
+ currentroots = {torev(node) for node in self.phaseroots[targetphase]}
finalroots = oldroots = set(currentroots)
- newroots = [
- n for n in nodes if self.phase(repo, repo[n].rev()) < targetphase
- ]
+ newroots = [torev(node) for node in nodes]
+ newroots = [rev for rev in newroots if self.phase(repo, rev) < targetphase]
+
if newroots:
-
- if nullid in newroots:
+ if nullrev in newroots:
raise error.Abort(_(b'cannot change null revision phase'))
- currentroots = currentroots.copy()
currentroots.update(newroots)
# Only compute new roots for revs above the roots that are being
# retracted.
- minnewroot = min(repo[n].rev() for n in newroots)
- aboveroots = [
- n for n in currentroots if repo[n].rev() >= minnewroot
- ]
- updatedroots = repo.set(b'roots(%ln::)', aboveroots)
+ minnewroot = min(newroots)
+ aboveroots = [rev for rev in currentroots if rev >= minnewroot]
+ updatedroots = repo.set(b'roots(%ld::)', aboveroots)
- finalroots = {n for n in currentroots if repo[n].rev() < minnewroot}
- finalroots.update(ctx.node() for ctx in updatedroots)
+ finalroots = {rev for rev in currentroots if rev < minnewroot}
+ finalroots.update(ctx.rev() for ctx in updatedroots)
if finalroots != oldroots:
- self._updateroots(targetphase, finalroots, tr)
+ self._updateroots(targetphase, {tonode(rev) for rev in finalroots}, tr)
return True
return False
To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200619/9133b35c/attachment-0002.html>
More information about the Mercurial-patches
mailing list