Mercurial > hg
comparison mercurial/cext/parsers.c @ 48044:d5528ac9b4f2
dirstate: Use the Rust implementation of DirstateItem when Rust is enabled
… instead of the C implementation, with C/Rust conversions at the FFI boundary
Differential Revision: https://phab.mercurial-scm.org/D11486
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 11:33:29 +0200 |
parents | 448aff4e8dd4 |
children | a660d8a53267 |
comparison
equal
deleted
inserted
replaced
48043:3e69bef2031a | 48044:d5528ac9b4f2 |
---|---|
1231 | 1231 |
1232 static const int version = 20; | 1232 static const int version = 20; |
1233 | 1233 |
1234 static void module_init(PyObject *mod) | 1234 static void module_init(PyObject *mod) |
1235 { | 1235 { |
1236 PyObject *capsule = NULL; | |
1237 PyModule_AddIntConstant(mod, "version", version); | 1236 PyModule_AddIntConstant(mod, "version", version); |
1238 | 1237 |
1239 /* This module constant has two purposes. First, it lets us unit test | 1238 /* This module constant has two purposes. First, it lets us unit test |
1240 * the ImportError raised without hard-coding any error text. This | 1239 * the ImportError raised without hard-coding any error text. This |
1241 * means we can change the text in the future without breaking tests, | 1240 * means we can change the text in the future without breaking tests, |
1247 PyModule_AddStringConstant(mod, "versionerrortext", versionerrortext); | 1246 PyModule_AddStringConstant(mod, "versionerrortext", versionerrortext); |
1248 | 1247 |
1249 dirs_module_init(mod); | 1248 dirs_module_init(mod); |
1250 manifest_module_init(mod); | 1249 manifest_module_init(mod); |
1251 revlog_module_init(mod); | 1250 revlog_module_init(mod); |
1252 | |
1253 capsule = PyCapsule_New( | |
1254 dirstate_item_from_v1_data, | |
1255 "mercurial.cext.parsers.make_dirstate_item_CAPI", NULL); | |
1256 if (capsule != NULL) | |
1257 PyModule_AddObject(mod, "make_dirstate_item_CAPI", capsule); | |
1258 | 1251 |
1259 if (PyType_Ready(&dirstateItemType) < 0) { | 1252 if (PyType_Ready(&dirstateItemType) < 0) { |
1260 return; | 1253 return; |
1261 } | 1254 } |
1262 Py_INCREF(&dirstateItemType); | 1255 Py_INCREF(&dirstateItemType); |