mercurial/phases.py
changeset 51410 eababb7b4a82
parent 51409 2f39c7aeb549
child 51411 774e4eff6e47
--- a/mercurial/phases.py	Wed Feb 21 10:41:09 2024 +0100
+++ b/mercurial/phases.py	Tue Feb 20 23:46:21 2024 +0100
@@ -645,11 +645,6 @@
         return changes
 
     def retractboundary(self, repo, tr, targetphase, nodes):
-        oldroots = {
-            phase: revs
-            for phase, revs in self._phaseroots.items()
-            if phase <= targetphase
-        }
         if tr is None:
             phasetracking = None
         else:
@@ -657,22 +652,8 @@
         repo = repo.unfiltered()
         retracted = self._retractboundary(repo, tr, targetphase, nodes)
         if retracted and phasetracking is not None:
-
-            # find the affected revisions
-            new = self._phaseroots[targetphase]
-            old = oldroots[targetphase]
-            affected = set(repo.revs(b'(%ld::) - (%ld::)', new, old))
-
-            # find the phase of the affected revision
-            for phase in range(targetphase, -1, -1):
-                if phase:
-                    roots = oldroots.get(phase, [])
-                    revs = set(repo.revs(b'%ld::%ld', roots, affected))
-                    affected -= revs
-                else:  # public phase
-                    revs = affected
-                for r in sorted(revs):
-                    _trackphasechange(phasetracking, r, phase, targetphase)
+            for r, old_phase in sorted(retracted.items()):
+                _trackphasechange(phasetracking, r, old_phase, targetphase)
         repo.invalidatevolatilesets()
 
     def _retractboundary(self, repo, tr, targetphase, nodes=None, revs=None):