comparison mercurial/pure/parsers.py @ 48769:1bb62821f080

revlog: register changelogv2 C implementation in parsers This allows Python code to make use of the C implementation of the changelogv2 base operations when the C extensions are enabled. The `format_version` values are now shared between the C and Python sides, avoiding an additional translation for the selection of the format version to use. Differential Revision: https://phab.mercurial-scm.org/D12179
author pacien <pacien.trangirard@pacien.net>
date Mon, 07 Feb 2022 13:23:58 +0100
parents c514936d92b4
children 5aafc3c5bdec
comparison
equal deleted inserted replaced
48768:7dd5a2c0116a 48769:1bb62821f080
797 797
798 def _calculate_index(self, i): 798 def _calculate_index(self, i):
799 return self._offsets[i] 799 return self._offsets[i]
800 800
801 801
802 def parse_index2(data, inline, revlogv2=False): 802 def parse_index2(data, inline, format=revlog_constants.REVLOGV1):
803 if format == revlog_constants.CHANGELOGV2:
804 return parse_index_cl_v2(data)
803 if not inline: 805 if not inline:
804 cls = IndexObject2 if revlogv2 else IndexObject 806 if format == revlog_constants.REVLOGV2:
807 cls = IndexObject2
808 else:
809 cls = IndexObject
805 return cls(data), None 810 return cls(data), None
806 cls = InlinedIndexObject 811 cls = InlinedIndexObject
807 return cls(data, inline), (0, data) 812 return cls(data, inline), (0, data)
808 813
809 814