Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 50658: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 | f952be90b051 |
children | 12f13b13f414 |
comparison
equal
deleted
inserted
replaced
50657:bf16ef96defe | 50658:978ffa09910b |
---|---|
512 | 512 |
513 if self.postfix is not None: | 513 if self.postfix is not None: |
514 entry_point = b'%s.i.%s' % (self.radix, self.postfix) | 514 entry_point = b'%s.i.%s' % (self.radix, self.postfix) |
515 elif self._trypending and self.opener.exists(b'%s.i.a' % self.radix): | 515 elif self._trypending and self.opener.exists(b'%s.i.a' % self.radix): |
516 entry_point = b'%s.i.a' % self.radix | 516 entry_point = b'%s.i.a' % self.radix |
517 elif self._try_split and self.opener.exists(b'%s.i.s' % self.radix): | 517 elif self._try_split and self.opener.exists(self._split_index_file): |
518 entry_point = b'%s.i.s' % self.radix | 518 entry_point = self._split_index_file |
519 else: | 519 else: |
520 entry_point = b'%s.i' % self.radix | 520 entry_point = b'%s.i' % self.radix |
521 | 521 |
522 if docket is not None: | 522 if docket is not None: |
523 self._docket = docket | 523 self._docket = docket |
2018 except error.RevlogError: | 2018 except error.RevlogError: |
2019 if self._censorable and storageutil.iscensoredtext(text): | 2019 if self._censorable and storageutil.iscensoredtext(text): |
2020 raise error.CensoredNodeError(self.display_id, node, text) | 2020 raise error.CensoredNodeError(self.display_id, node, text) |
2021 raise | 2021 raise |
2022 | 2022 |
2023 @property | |
2024 def _split_index_file(self): | |
2025 """the path where to expect the index of an ongoing splitting operation | |
2026 | |
2027 The file will only exist if a splitting operation is in progress, but | |
2028 it is always expected at the same location.""" | |
2029 return self.radix + b'.i.s' | |
2030 | |
2023 def _enforceinlinesize(self, tr, side_write=True): | 2031 def _enforceinlinesize(self, tr, side_write=True): |
2024 """Check if the revlog is too big for inline and convert if so. | 2032 """Check if the revlog is too big for inline and convert if so. |
2025 | 2033 |
2026 This should be called after revisions are added to the revlog. If the | 2034 This should be called after revisions are added to the revlog. If the |
2027 revlog has grown too large to be an inline revlog, it will convert it | 2035 revlog has grown too large to be an inline revlog, it will convert it |
2054 # No need to deal with sidedata writing handle as it is only | 2062 # No need to deal with sidedata writing handle as it is only |
2055 # relevant with revlog-v2 which is never inline, not reaching | 2063 # relevant with revlog-v2 which is never inline, not reaching |
2056 # this code | 2064 # this code |
2057 if side_write: | 2065 if side_write: |
2058 old_index_file_path = self._indexfile | 2066 old_index_file_path = self._indexfile |
2059 new_index_file_path = self._indexfile + b'.s' | 2067 new_index_file_path = self._split_index_file |
2060 opener = self.opener | 2068 opener = self.opener |
2061 weak_self = weakref.ref(self) | 2069 weak_self = weakref.ref(self) |
2062 | 2070 |
2063 fncache = getattr(opener, 'fncache', None) | 2071 fncache = getattr(opener, 'fncache', None) |
2064 if fncache is not None: | 2072 if fncache is not None: |