comparison mercurial/parsers.c @ 24214:a5f1bccd2996

manifest.c: new extension code to lazily parse manifests This lets us iterate manifests in order, but do a _lot_ less work in the common case when we only care about a few manifest entries. Many thanks to Mike Edgar for reviewing this in advance of it going out to the list, which caught many things I missed. This version of the patch includes C89 fixes from Sean Farley and many correctness/efficiency cleanups from Martin von Zweigbergk. Thanks to both!
author Augie Fackler <augie@google.com>
date Tue, 13 Jan 2015 14:31:38 -0800
parents c53bc2e52514
children 539b3c7eea44
comparison
equal deleted inserted replaced
24213:e0c1328df872 24214:a5f1bccd2996
69 } 69 }
70 70
71 /* 71 /*
72 * Turn a hex-encoded string into binary. 72 * Turn a hex-encoded string into binary.
73 */ 73 */
74 static PyObject *unhexlify(const char *str, int len) 74 PyObject *unhexlify(const char *str, int len)
75 { 75 {
76 PyObject *ret; 76 PyObject *ret;
77 char *d; 77 char *d;
78 int i; 78 int i;
79 79
2316 "parse v1 obsolete markers\n"}, 2316 "parse v1 obsolete markers\n"},
2317 {NULL, NULL} 2317 {NULL, NULL}
2318 }; 2318 };
2319 2319
2320 void dirs_module_init(PyObject *mod); 2320 void dirs_module_init(PyObject *mod);
2321 void manifest_module_init(PyObject *mod);
2321 2322
2322 static void module_init(PyObject *mod) 2323 static void module_init(PyObject *mod)
2323 { 2324 {
2324 /* This module constant has two purposes. First, it lets us unit test 2325 /* This module constant has two purposes. First, it lets us unit test
2325 * the ImportError raised without hard-coding any error text. This 2326 * the ImportError raised without hard-coding any error text. This
2330 * recompile. Note that this means the pure-Python version of parsers 2331 * recompile. Note that this means the pure-Python version of parsers
2331 * should not have this module constant. */ 2332 * should not have this module constant. */
2332 PyModule_AddStringConstant(mod, "versionerrortext", versionerrortext); 2333 PyModule_AddStringConstant(mod, "versionerrortext", versionerrortext);
2333 2334
2334 dirs_module_init(mod); 2335 dirs_module_init(mod);
2336 manifest_module_init(mod);
2335 2337
2336 indexType.tp_new = PyType_GenericNew; 2338 indexType.tp_new = PyType_GenericNew;
2337 if (PyType_Ready(&indexType) < 0 || 2339 if (PyType_Ready(&indexType) < 0 ||
2338 PyType_Ready(&dirstateTupleType) < 0) 2340 PyType_Ready(&dirstateTupleType) < 0)
2339 return; 2341 return;