Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 48772: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 | 580660518459 |
children | d739cd69bb6a |
comparison
equal
deleted
inserted
replaced
48771:7dd5a2c0116a | 48772:1bb62821f080 |
---|---|
101 # We need these name available in the module for extensions. | 101 # We need these name available in the module for extensions. |
102 | 102 |
103 REVLOGV0 | 103 REVLOGV0 |
104 REVLOGV1 | 104 REVLOGV1 |
105 REVLOGV2 | 105 REVLOGV2 |
106 CHANGELOGV2 | |
106 FLAG_INLINE_DATA | 107 FLAG_INLINE_DATA |
107 FLAG_GENERALDELTA | 108 FLAG_GENERALDELTA |
108 REVLOG_DEFAULT_FLAGS | 109 REVLOG_DEFAULT_FLAGS |
109 REVLOG_DEFAULT_FORMAT | 110 REVLOG_DEFAULT_FORMAT |
110 REVLOG_DEFAULT_VERSION | 111 REVLOG_DEFAULT_VERSION |
199 return index, cache | 200 return index, cache |
200 | 201 |
201 | 202 |
202 def parse_index_v2(data, inline): | 203 def parse_index_v2(data, inline): |
203 # call the C implementation to parse the index data | 204 # call the C implementation to parse the index data |
204 index, cache = parsers.parse_index2(data, inline, revlogv2=True) | 205 index, cache = parsers.parse_index2(data, inline, format=REVLOGV2) |
205 return index, cache | 206 return index, cache |
206 | 207 |
207 | 208 |
208 def parse_index_cl_v2(data, inline): | 209 def parse_index_cl_v2(data, inline): |
209 # call the C implementation to parse the index data | 210 # call the C implementation to parse the index data |
210 assert not inline | 211 index, cache = parsers.parse_index2(data, inline, format=CHANGELOGV2) |
211 from .pure.parsers import parse_index_cl_v2 | |
212 | |
213 index, cache = parse_index_cl_v2(data) | |
214 return index, cache | 212 return index, cache |
215 | 213 |
216 | 214 |
217 if util.safehasattr(parsers, 'parse_index_devel_nodemap'): | 215 if util.safehasattr(parsers, 'parse_index_devel_nodemap'): |
218 | 216 |