diff mercurial/revlogutils/randomaccessfile.py @ 51106:594f912818ab

changelog-delay: adds some check around delaying and diverting write Theses assert shows we never call delay or divert if the revlog hold file handle on the revlog's file.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Oct 2023 12:13:33 +0200
parents 3314c41c3759
children 222b89224397
line wrap: on
line diff
--- a/mercurial/revlogutils/randomaccessfile.py	Wed Oct 25 23:14:20 2023 +0200
+++ b/mercurial/revlogutils/randomaccessfile.py	Fri Oct 20 12:13:33 2023 +0200
@@ -50,6 +50,15 @@
         self._cached_chunk = b''
         self._cached_chunk_position = 0
 
+    @property
+    def is_open(self):
+        """True if any file handle is being held
+
+        Used for assert and debug in the python code"""
+        return (
+            self.reading_handle is not None or self.writing_handle is not None
+        )
+
     def _open(self, mode=b'r'):
         """Return a file object"""
         return self.opener(self.filename, mode=mode)