Mercurial > hg
comparison mercurial/revlog.py @ 50686:a41eeb877d07
branching: merge with stable
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 18 Jun 2023 00:09:39 +0200 |
parents | 12f13b13f414 |
children | 4a3a9d961561 |
comparison
equal
deleted
inserted
replaced
50685:b9a355763e76 | 50686:a41eeb877d07 |
---|---|
613 | 613 |
614 if self.postfix is not None: | 614 if self.postfix is not None: |
615 entry_point = b'%s.i.%s' % (self.radix, self.postfix) | 615 entry_point = b'%s.i.%s' % (self.radix, self.postfix) |
616 elif self._trypending and self.opener.exists(b'%s.i.a' % self.radix): | 616 elif self._trypending and self.opener.exists(b'%s.i.a' % self.radix): |
617 entry_point = b'%s.i.a' % self.radix | 617 entry_point = b'%s.i.a' % self.radix |
618 elif self._try_split and self.opener.exists(b'%s.i.s' % self.radix): | 618 elif self._try_split and self.opener.exists(self._split_index_file): |
619 entry_point = b'%s.i.s' % self.radix | 619 entry_point = self._split_index_file |
620 else: | 620 else: |
621 entry_point = b'%s.i' % self.radix | 621 entry_point = b'%s.i' % self.radix |
622 | 622 |
623 if docket is not None: | 623 if docket is not None: |
624 self._docket = docket | 624 self._docket = docket |
2123 except error.RevlogError: | 2123 except error.RevlogError: |
2124 if self._censorable and storageutil.iscensoredtext(text): | 2124 if self._censorable and storageutil.iscensoredtext(text): |
2125 raise error.CensoredNodeError(self.display_id, node, text) | 2125 raise error.CensoredNodeError(self.display_id, node, text) |
2126 raise | 2126 raise |
2127 | 2127 |
2128 @property | |
2129 def _split_index_file(self): | |
2130 """the path where to expect the index of an ongoing splitting operation | |
2131 | |
2132 The file will only exist if a splitting operation is in progress, but | |
2133 it is always expected at the same location.""" | |
2134 parts = os.path.split(self.radix) | |
2135 if len(parts) > 1: | |
2136 # adds a '-s' prefix to the ``data/` or `meta/` base | |
2137 head = parts[0] + b'-s' | |
2138 return os.path.join(head, *parts[1:]) | |
2139 else: | |
2140 # the revlog is stored at the root of the store (changelog or | |
2141 # manifest), no risk of collision. | |
2142 return self.radix + b'.i.s' | |
2143 | |
2128 def _enforceinlinesize(self, tr, side_write=True): | 2144 def _enforceinlinesize(self, tr, side_write=True): |
2129 """Check if the revlog is too big for inline and convert if so. | 2145 """Check if the revlog is too big for inline and convert if so. |
2130 | 2146 |
2131 This should be called after revisions are added to the revlog. If the | 2147 This should be called after revisions are added to the revlog. If the |
2132 revlog has grown too large to be an inline revlog, it will convert it | 2148 revlog has grown too large to be an inline revlog, it will convert it |
2159 # No need to deal with sidedata writing handle as it is only | 2175 # No need to deal with sidedata writing handle as it is only |
2160 # relevant with revlog-v2 which is never inline, not reaching | 2176 # relevant with revlog-v2 which is never inline, not reaching |
2161 # this code | 2177 # this code |
2162 if side_write: | 2178 if side_write: |
2163 old_index_file_path = self._indexfile | 2179 old_index_file_path = self._indexfile |
2164 new_index_file_path = self._indexfile + b'.s' | 2180 new_index_file_path = self._split_index_file |
2165 opener = self.opener | 2181 opener = self.opener |
2166 weak_self = weakref.ref(self) | 2182 weak_self = weakref.ref(self) |
2167 | 2183 |
2168 # the "split" index replace the real index when the transaction is finalized | 2184 # the "split" index replace the real index when the transaction is finalized |
2169 def finalize_callback(tr): | 2185 def finalize_callback(tr): |