phases: directly update the phase sets in advanceboundary
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 23 Feb 2024 06:37:25 +0100
changeset 51424 3cee8706f53b
parent 51423 23950e39281f
child 51425 7c6d0b9dde37
phases: directly update the phase sets in advanceboundary This is similar to what we do in retractboundary. There is no need to invalidate the cache if we have everything at hand to update it.
mercurial/phases.py
--- a/mercurial/phases.py	Fri Feb 23 05:25:35 2024 +0100
+++ b/mercurial/phases.py	Fri Feb 23 06:37:25 2024 +0100
@@ -769,19 +769,26 @@
         if not dryrun:
             for r, p in changed.items():
                 _trackphasechange(phasetracking, r, p, targetphase)
+            if targetphase > public:
+                self._phasesets[targetphase].update(changed)
             for phase in affectable_phases:
                 roots = self._phaseroots[phase]
                 removed = roots & delroots
                 if removed or new_roots[phase]:
+                    self._phasesets[phase].difference_update(changed)
                     # Be careful to preserve shallow-copied values: do not
                     # update phaseroots values, replace them.
                     final_roots = roots - delroots | new_roots[phase]
-                    self._updateroots(repo, phase, final_roots, tr)
+                    self._updateroots(
+                        repo, phase, final_roots, tr, invalidate=False
+                    )
             if new_target_roots:
                 # Thanks for previous filtering, we can't replace existing
                 # roots
                 new_target_roots |= self._phaseroots[targetphase]
-                self._updateroots(repo, targetphase, new_target_roots, tr)
+                self._updateroots(
+                    repo, targetphase, new_target_roots, tr, invalidate=False
+                )
             repo.invalidatevolatilesets()
         return changed