Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 51058:7c2dc75cdc0f
revlog: remove legacy usage of `hassidedata`
All core code is now getting the setting from the FeatureConfig object.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 10 Oct 2023 11:29:19 +0200 |
parents | f71f07a679b4 |
children | 81f3877372c3 |
comparison
equal
deleted
inserted
replaced
51057:f71f07a679b4 | 51058:7c2dc75cdc0f |
---|---|
1154 | 1154 |
1155 def length(self, rev): | 1155 def length(self, rev): |
1156 return self.index[rev][1] | 1156 return self.index[rev][1] |
1157 | 1157 |
1158 def sidedata_length(self, rev): | 1158 def sidedata_length(self, rev): |
1159 if not self.hassidedata: | 1159 if not self.feature_config.has_side_data: |
1160 return 0 | 1160 return 0 |
1161 return self.index[rev][9] | 1161 return self.index[rev][9] |
1162 | 1162 |
1163 def rawsize(self, rev): | 1163 def rawsize(self, rev): |
1164 """return the length of the uncompressed text for a given revision""" | 1164 """return the length of the uncompressed text for a given revision""" |
2563 _(b"attempted to add linkrev -1 to %s") % self.display_id | 2563 _(b"attempted to add linkrev -1 to %s") % self.display_id |
2564 ) | 2564 ) |
2565 | 2565 |
2566 if sidedata is None: | 2566 if sidedata is None: |
2567 sidedata = {} | 2567 sidedata = {} |
2568 elif sidedata and not self.hassidedata: | 2568 elif sidedata and not self.feature_config.has_side_data: |
2569 raise error.ProgrammingError( | 2569 raise error.ProgrammingError( |
2570 _(b"trying to add sidedata to a revlog who don't support them") | 2570 _(b"trying to add sidedata to a revlog who don't support them") |
2571 ) | 2571 ) |
2572 | 2572 |
2573 if flags: | 2573 if flags: |
2822 default_comp = self._docket.default_compression_header | 2822 default_comp = self._docket.default_compression_header |
2823 r = deltautil.delta_compression(default_comp, deltainfo) | 2823 r = deltautil.delta_compression(default_comp, deltainfo) |
2824 compression_mode, deltainfo = r | 2824 compression_mode, deltainfo = r |
2825 | 2825 |
2826 sidedata_compression_mode = COMP_MODE_INLINE | 2826 sidedata_compression_mode = COMP_MODE_INLINE |
2827 if sidedata and self.hassidedata: | 2827 if sidedata and self.feature_config.has_side_data: |
2828 sidedata_compression_mode = COMP_MODE_PLAIN | 2828 sidedata_compression_mode = COMP_MODE_PLAIN |
2829 serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) | 2829 serialized_sidedata = sidedatautil.serialize_sidedata(sidedata) |
2830 sidedata_offset = self._docket.sidedata_end | 2830 sidedata_offset = self._docket.sidedata_end |
2831 h, comp_sidedata = self.compress(serialized_sidedata) | 2831 h, comp_sidedata = self.compress(serialized_sidedata) |
2832 if ( | 2832 if ( |
3638 ) | 3638 ) |
3639 | 3639 |
3640 return d | 3640 return d |
3641 | 3641 |
3642 def rewrite_sidedata(self, transaction, helpers, startrev, endrev): | 3642 def rewrite_sidedata(self, transaction, helpers, startrev, endrev): |
3643 if not self.hassidedata: | 3643 if not self.feature_config.has_side_data: |
3644 return | 3644 return |
3645 # revlog formats with sidedata support does not support inline | 3645 # revlog formats with sidedata support does not support inline |
3646 assert not self._inline | 3646 assert not self._inline |
3647 if not helpers[1] and not helpers[2]: | 3647 if not helpers[1] and not helpers[2]: |
3648 # Nothing to generate or remove | 3648 # Nothing to generate or remove |
3667 serialized_sidedata = sidedatautil.serialize_sidedata( | 3667 serialized_sidedata = sidedatautil.serialize_sidedata( |
3668 new_sidedata | 3668 new_sidedata |
3669 ) | 3669 ) |
3670 | 3670 |
3671 sidedata_compression_mode = COMP_MODE_INLINE | 3671 sidedata_compression_mode = COMP_MODE_INLINE |
3672 if serialized_sidedata and self.hassidedata: | 3672 if serialized_sidedata and self.feature_config.has_side_data: |
3673 sidedata_compression_mode = COMP_MODE_PLAIN | 3673 sidedata_compression_mode = COMP_MODE_PLAIN |
3674 h, comp_sidedata = self.compress(serialized_sidedata) | 3674 h, comp_sidedata = self.compress(serialized_sidedata) |
3675 if ( | 3675 if ( |
3676 h != b'u' | 3676 h != b'u' |
3677 and comp_sidedata[0] != b'\0' | 3677 and comp_sidedata[0] != b'\0' |