Mercurial > hg
changeset 51421:2eb93812d2a5
phases: filter revision that are already in the right phase
No need to compute new roots if everything is already in order.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 21 Feb 2024 11:09:25 +0100 |
parents | ac1c75188440 |
children | 709525b26cf5 |
files | mercurial/phases.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/phases.py Wed Feb 21 13:05:29 2024 +0100 +++ b/mercurial/phases.py Wed Feb 21 11:09:25 2024 +0100 @@ -748,6 +748,14 @@ if nullrev in new_revs: raise error.Abort(_(b'cannot change null revision phase')) + # Filter revision that are already in the right phase + self._ensure_phase_sets(repo) + for phase, revs in self._phasesets.items(): + if phase >= targetphase: + new_revs -= revs + if not new_revs: # all revisions already in the right phases + return {} + # Compute change in phase roots by walking the graph # # note: If we had a cheap parent → children mapping we could do