mercurial/store.py
changeset 52357 a260d326458f
parent 52171 bd43465af568
child 52359 3f0cf7bb3086
--- a/mercurial/store.py	Mon Dec 02 16:01:00 2024 +0100
+++ b/mercurial/store.py	Mon Dec 02 17:00:12 2024 +0100
@@ -524,6 +524,16 @@
         assert vfs is not None
         return [f.get_stream(vfs, volatiles) for f in self.files()]
 
+    def preserve_volatiles(self, vfs, volatiles):
+        """Use a VolatileManager to preserve the state of any volatile file
+
+        This is useful for code that need a consistent view of the content like stream clone.
+        """
+        if self.maybe_volatile:
+            for f in self.files():
+                if f.is_volatile:
+                    volatiles(vfs.join(f.unencoded_path))
+
 
 @attr.s(slots=True, init=False)
 class SimpleStoreEntry(BaseStoreEntry):