diff mercurial/changelog.py @ 51102: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 c3748f38dcd0
children 222b89224397
line wrap: on
line diff
--- a/mercurial/changelog.py	Wed Oct 25 23:14:20 2023 +0200
+++ b/mercurial/changelog.py	Fri Oct 20 12:13:33 2023 +0200
@@ -448,6 +448,7 @@
 
     def delayupdate(self, tr):
         """delay visibility of index updates to other readers"""
+        assert not self._inner.is_open
         if self._docket is None and not self._delayed:
             if len(self) == 0:
                 self._divert = True
@@ -468,6 +469,7 @@
 
     def _finalize(self, tr):
         """finalize index updates"""
+        assert not self._inner.is_open
         self._delayed = False
         self.opener = self._realopener
         self._inner.opener = self.opener
@@ -494,6 +496,7 @@
     def _writepending(self, tr):
         """create a file containing the unfinalized state for
         pretxnchangegroup"""
+        assert not self._inner.is_open
         if self._docket:
             return self._docket.write(tr, pending=True)
         if self._delaybuf: