diff 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
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Mon Feb 14 12:34:02 2022 +0100
+++ b/mercurial/pure/parsers.py	Mon Feb 07 13:23:58 2022 +0100
@@ -799,9 +799,14 @@
         return self._offsets[i]
 
 
-def parse_index2(data, inline, revlogv2=False):
+def parse_index2(data, inline, format=revlog_constants.REVLOGV1):
+    if format == revlog_constants.CHANGELOGV2:
+        return parse_index_cl_v2(data)
     if not inline:
-        cls = IndexObject2 if revlogv2 else IndexObject
+        if format == revlog_constants.REVLOGV2:
+            cls = IndexObject2
+        else:
+            cls = IndexObject
         return cls(data), None
     cls = InlinedIndexObject
     return cls(data, inline), (0, data)