--- a/mercurial/revlog.py Tue Jun 20 02:36:52 2023 +0200
+++ b/mercurial/revlog.py Sun Jun 18 00:09:39 2023 +0200
@@ -615,8 +615,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
@@ -2125,6 +2125,22 @@
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."""
+ parts = os.path.split(self.radix)
+ if len(parts) > 1:
+ # adds a '-s' prefix to the ``data/` or `meta/` base
+ head = parts[0] + b'-s'
+ return os.path.join(head, *parts[1:])
+ else:
+ # the revlog is stored at the root of the store (changelog or
+ # manifest), no risk of collision.
+ 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.
@@ -2161,7 +2177,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)