changeset 50661:978ffa09910b stable

revlog: move the computation of the split_index path in a property This is about to become more complex, so we gather the logic in a single place.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jun 2023 11:08:19 +0200
parents bf16ef96defe
children 12f13b13f414
files mercurial/revlog.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon Jun 05 16:43:27 2023 +0200
+++ b/mercurial/revlog.py	Thu Jun 08 11:08:19 2023 +0200
@@ -514,8 +514,8 @@
             entry_point = b'%s.i.%s' % (self.radix, self.postfix)
         elif self._trypending and self.opener.exists(b'%s.i.a' % self.radix):
             entry_point = b'%s.i.a' % self.radix
-        elif self._try_split and self.opener.exists(b'%s.i.s' % self.radix):
-            entry_point = b'%s.i.s' % self.radix
+        elif self._try_split and self.opener.exists(self._split_index_file):
+            entry_point = self._split_index_file
         else:
             entry_point = b'%s.i' % self.radix
 
@@ -2020,6 +2020,14 @@
                 raise error.CensoredNodeError(self.display_id, node, text)
             raise
 
+    @property
+    def _split_index_file(self):
+        """the path where to expect the index of an ongoing splitting operation
+
+        The file will only exist if a splitting operation is in progress, but
+        it is always expected at the same location."""
+        return self.radix + b'.i.s'
+
     def _enforceinlinesize(self, tr, side_write=True):
         """Check if the revlog is too big for inline and convert if so.
 
@@ -2056,7 +2064,7 @@
             # this code
         if side_write:
             old_index_file_path = self._indexfile
-            new_index_file_path = self._indexfile + b'.s'
+            new_index_file_path = self._split_index_file
             opener = self.opener
             weak_self = weakref.ref(self)