changeset 51165:66417f55ea33 stable

revlog: avoid exposing delayed index entry too widely in non-inline revlog Before this change, the index entry would be seen as "appended" to the data file. It did not hurt too much as there are never accessed for reading, but this was odd. So lets stop doing so.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 07 Dec 2023 00:34:08 +0100
parents 962974a5d068
children 849745d7da89
files mercurial/revlog.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Dec 06 15:38:15 2023 +0100
+++ b/mercurial/revlog.py	Thu Dec 07 00:34:08 2023 +0100
@@ -1173,7 +1173,9 @@
                 self.opener.unlink(self.index_file)
             return self.index_file
         else:
-            self._segmentfile._delay_buffer = self._delay_buffer = []
+            self._delay_buffer = []
+            if self.inline:
+                self._segmentfile._delay_buffer = self._delay_buffer
             return None
 
     def write_pending(self):
@@ -1193,7 +1195,11 @@
                 ifh.seek(0, os.SEEK_END)
                 ifh.write(b"".join(self._delay_buffer))
             any_pending = True
-        self._segmentfile._delay_buffer = self._delay_buffer = None
+        self._delay_buffer = None
+        if self.inline:
+            self._segmentfile._delay_buffer = self._delay_buffer
+        else:
+            assert self._segmentfile._delay_buffer is None
         self._orig_index_file = self.index_file
         self.index_file = pending_index_file
         self._segmentfile.filename = self.index_file