# HG changeset patch # User Pierre-Yves David # Date 2024-02-21 10:09:25 # Node ID 2eb93812d2a56c838aacc8863c16cd0dc2149e51 # Parent ac1c751884406f561b68bf40607339c06ed8605a phases: filter revision that are already in the right phase No need to compute new roots if everything is already in order. diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -748,6 +748,14 @@ class phasecache: 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