Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 51314:5b3b6db49bbb
changelog: drop the side_write argument to revlog splitting
The only user is now gone.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 11 Jan 2024 16:39:31 +0100 |
parents | ceeb8fa23cc8 |
children | 0106df85efd5 |
comparison
equal
deleted
inserted
replaced
51313:178e50edb4f8 | 51314:5b3b6db49bbb |
---|---|
2825 else: | 2825 else: |
2826 # the revlog is stored at the root of the store (changelog or | 2826 # the revlog is stored at the root of the store (changelog or |
2827 # manifest), no risk of collision. | 2827 # manifest), no risk of collision. |
2828 return self.radix + b'.i.s' | 2828 return self.radix + b'.i.s' |
2829 | 2829 |
2830 def _enforceinlinesize(self, tr, side_write=True): | 2830 def _enforceinlinesize(self, tr): |
2831 """Check if the revlog is too big for inline and convert if so. | 2831 """Check if the revlog is too big for inline and convert if so. |
2832 | 2832 |
2833 This should be called after revisions are added to the revlog. If the | 2833 This should be called after revisions are added to the revlog. If the |
2834 revlog has grown too large to be an inline revlog, it will convert it | 2834 revlog has grown too large to be an inline revlog, it will convert it |
2835 to use multiple index and data files. | 2835 to use multiple index and data files. |
2855 | 2855 |
2856 tr.addbackup(self._inner.canonical_index_file, for_offset=pre_touched) | 2856 tr.addbackup(self._inner.canonical_index_file, for_offset=pre_touched) |
2857 tr.add(self._datafile, 0) | 2857 tr.add(self._datafile, 0) |
2858 | 2858 |
2859 new_index_file_path = None | 2859 new_index_file_path = None |
2860 if side_write: | 2860 old_index_file_path = self._indexfile |
2861 old_index_file_path = self._indexfile | 2861 new_index_file_path = self._split_index_file |
2862 new_index_file_path = self._split_index_file | 2862 opener = self.opener |
2863 opener = self.opener | 2863 weak_self = weakref.ref(self) |
2864 weak_self = weakref.ref(self) | 2864 |
2865 | 2865 # the "split" index replace the real index when the transaction is |
2866 # the "split" index replace the real index when the transaction is | 2866 # finalized |
2867 # finalized | 2867 def finalize_callback(tr): |
2868 def finalize_callback(tr): | 2868 opener.rename( |
2869 opener.rename( | 2869 new_index_file_path, |
2870 new_index_file_path, | 2870 old_index_file_path, |
2871 old_index_file_path, | 2871 checkambig=True, |
2872 checkambig=True, | 2872 ) |
2873 ) | 2873 maybe_self = weak_self() |
2874 maybe_self = weak_self() | 2874 if maybe_self is not None: |
2875 if maybe_self is not None: | 2875 maybe_self._indexfile = old_index_file_path |
2876 maybe_self._indexfile = old_index_file_path | 2876 maybe_self._inner.index_file = maybe_self._indexfile |
2877 maybe_self._inner.index_file = maybe_self._indexfile | 2877 |
2878 | 2878 def abort_callback(tr): |
2879 def abort_callback(tr): | 2879 maybe_self = weak_self() |
2880 maybe_self = weak_self() | 2880 if maybe_self is not None: |
2881 if maybe_self is not None: | 2881 maybe_self._indexfile = old_index_file_path |
2882 maybe_self._indexfile = old_index_file_path | 2882 maybe_self._inner.inline = True |
2883 maybe_self._inner.inline = True | 2883 maybe_self._inner.index_file = old_index_file_path |
2884 maybe_self._inner.index_file = old_index_file_path | 2884 |
2885 | 2885 tr.registertmp(new_index_file_path) |
2886 tr.registertmp(new_index_file_path) | 2886 if self.target[1] is not None: |
2887 if self.target[1] is not None: | 2887 callback_id = b'000-revlog-split-%d-%s' % self.target |
2888 callback_id = b'000-revlog-split-%d-%s' % self.target | 2888 else: |
2889 else: | 2889 callback_id = b'000-revlog-split-%d' % self.target[0] |
2890 callback_id = b'000-revlog-split-%d' % self.target[0] | 2890 tr.addfinalize(callback_id, finalize_callback) |
2891 tr.addfinalize(callback_id, finalize_callback) | 2891 tr.addabort(callback_id, abort_callback) |
2892 tr.addabort(callback_id, abort_callback) | |
2893 | 2892 |
2894 self._format_flags &= ~FLAG_INLINE_DATA | 2893 self._format_flags &= ~FLAG_INLINE_DATA |
2895 self._inner.split_inline( | 2894 self._inner.split_inline( |
2896 tr, | 2895 tr, |
2897 self._format_flags | self._format_version, | 2896 self._format_flags | self._format_version, |