changeset 51610:c11d21faa73c

phases: introduce a performant efficient way to access revision in a set This will be useful in the next changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 05 Apr 2024 22:47:44 +0200
parents 5b99b64328f2
children 1cef1412af3e
files mercurial/phases.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Fri Apr 05 14:13:47 2024 +0200
+++ b/mercurial/phases.py	Fri Apr 05 22:47:44 2024 +0200
@@ -414,6 +414,27 @@
             ]
         )
 
+    def get_raw_set(
+        self,
+        repo: "localrepo.localrepository",
+        phase: int,
+    ) -> Set[int]:
+        """return the set of revision in that phase
+
+        The returned set is not filtered and might contains revision filtered
+        for the passed repoview.
+
+        The returned set might be the internal one and MUST NOT be mutated to
+        avoid side effect.
+        """
+        if phase == public:
+            raise error.ProgrammingError("cannot get_set for public phase")
+        self._ensure_phase_sets(repo.unfiltered())
+        revs = self._phasesets.get(phase)
+        if revs is None:
+            return set()
+        return revs
+
     def getrevset(
         self,
         repo: "localrepo.localrepository",