comparison mercurial/revlog.py @ 50814:4a3a9d961561 stable

revlog: fix the naming scheme use by split temporary file The `-s` is now added on the first piece only and the `.i` is added to the index. This match the initially intended naming scheme.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 21 Jul 2023 15:50:56 +0200
parents a41eeb877d07
children d718eddf01d9 74c004a515bc
comparison
equal deleted inserted replaced
50813:4ee64ff1d49f 50814:4a3a9d961561
2129 def _split_index_file(self): 2129 def _split_index_file(self):
2130 """the path where to expect the index of an ongoing splitting operation 2130 """the path where to expect the index of an ongoing splitting operation
2131 2131
2132 The file will only exist if a splitting operation is in progress, but 2132 The file will only exist if a splitting operation is in progress, but
2133 it is always expected at the same location.""" 2133 it is always expected at the same location."""
2134 parts = os.path.split(self.radix) 2134 parts = self.radix.split(b'/')
2135 if len(parts) > 1: 2135 if len(parts) > 1:
2136 # adds a '-s' prefix to the ``data/` or `meta/` base 2136 # adds a '-s' prefix to the ``data/` or `meta/` base
2137 head = parts[0] + b'-s' 2137 head = parts[0] + b'-s'
2138 return os.path.join(head, *parts[1:]) 2138 mids = parts[1:-1]
2139 tail = parts[-1] + b'.i'
2140 pieces = [head] + mids + [tail]
2141 return b'/'.join(pieces)
2139 else: 2142 else:
2140 # the revlog is stored at the root of the store (changelog or 2143 # the revlog is stored at the root of the store (changelog or
2141 # manifest), no risk of collision. 2144 # manifest), no risk of collision.
2142 return self.radix + b'.i.s' 2145 return self.radix + b'.i.s'
2143 2146