mercurial/phases.py
changeset 51401 8f2ea3fa50fd
parent 51290 f4a0806081f2
child 51403 68289ed170c7
--- a/mercurial/phases.py	Fri Feb 23 04:26:03 2024 +0100
+++ b/mercurial/phases.py	Tue Feb 20 14:21:18 2024 +0100
@@ -702,6 +702,24 @@
             return True
         return False
 
+    def register_strip(
+        self,
+        repo: "localrepo.localrepository",
+        tr,
+        strip_rev: int,
+    ):
+        """announce a strip to the phase cache
+
+        Any roots higher than the stripped revision should be dropped.
+        """
+        assert repo.filtername is None
+        to_rev = repo.changelog.index.rev
+        for targetphase, nodes in list(self.phaseroots.items()):
+            filtered = {n for n in nodes if to_rev(n) >= strip_rev}
+            if filtered:
+                self._updateroots(targetphase, nodes - filtered, tr)
+        self.invalidate()
+
     def filterunknown(self, repo: "localrepo.localrepository") -> None:
         """remove unknown nodes from the phase boundary