changeset 51109:af96fbb8f739

revlog: add a `canonical_index_file` attribute on inner revlog This is currently the same and the index_file but it will become more complex when we start doing delayed write.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 26 Oct 2023 05:37:37 +0200
parents 1c0f3994d733
children d83d788590a8
files mercurial/revlog.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Oct 26 03:41:58 2023 +0200
+++ b/mercurial/revlog.py	Thu Oct 26 05:37:37 2023 +0200
@@ -411,6 +411,10 @@
         self._segmentfile.clear_cache()
         self._segmentfile_sidedata.clear_cache()
 
+    @property
+    def canonical_index_file(self):
+        return self.index_file
+
     # Derived from index values.
 
     def start(self, rev):
@@ -1034,7 +1038,7 @@
             transaction.add(self.data_file, offset)
             if self.sidedata_file:
                 transaction.add(self.sidedata_file, sidedata_offset)
-            transaction.add(self.index_file, curr * len(entry))
+            transaction.add(self.canonical_index_file, curr * len(entry))
             if data[0]:
                 dfh.write(data[0])
             dfh.write(data[1])
@@ -1043,7 +1047,7 @@
             ifh.write(entry)
         else:
             offset += curr * self.index.entry_size
-            transaction.add(self.index_file, offset)
+            transaction.add(self.canonical_index_file, offset)
             ifh.write(entry)
             ifh.write(data[0])
             ifh.write(data[1])
@@ -2833,13 +2837,13 @@
             msg = b"inline revlog should not have a docket"
             raise error.ProgrammingError(msg)
 
-        troffset = tr.findoffset(self._indexfile)
+        troffset = tr.findoffset(self._inner.canonical_index_file)
         if troffset is None:
             raise error.RevlogError(
                 _(b"%s not found in the transaction") % self._indexfile
             )
         if troffset:
-            tr.addbackup(self._indexfile, for_offset=True)
+            tr.addbackup(self._inner.canonical_index_file, for_offset=True)
         tr.add(self._datafile, 0)
 
         new_index_file_path = None