changeset 40859:aa76be85029b

revlog: export symbol of indexType The idea is to wrap the index object with rust-cpython. I haven't tried it, but it should be doable. We'll probably need a better interface than raw function pointers to do more in Rust.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 02 Dec 2018 21:37:42 +0900
parents 67d20f62fd19
children 18a8def6e1b5
files mercurial/cext/revlog.c mercurial/cext/revlog.h setup.py
diffstat 3 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Sun Dec 02 21:33:43 2018 +0900
+++ b/mercurial/cext/revlog.c	Sun Dec 02 21:37:42 2018 +0900
@@ -17,6 +17,7 @@
 
 #include "bitmanipulation.h"
 #include "charencode.h"
+#include "revlog.h"
 #include "util.h"
 
 #ifdef IS_PY3K
@@ -1511,8 +1512,6 @@
 	return 0;
 }
 
-static PyTypeObject indexType;
-
 static int ntobj_init(nodetreeObject *self, PyObject *args)
 {
 	PyObject *index;
@@ -2582,7 +2581,7 @@
     {NULL} /* Sentinel */
 };
 
-static PyTypeObject indexType = {
+PyTypeObject indexType = {
     PyVarObject_HEAD_INIT(NULL, 0) /* header */
     "parsers.index",               /* tp_name */
     sizeof(indexObject),           /* tp_basicsize */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/cext/revlog.h	Sun Dec 02 21:37:42 2018 +0900
@@ -0,0 +1,15 @@
+/*
+ revlog.h - efficient revlog parsing
+
+ This software may be used and distributed according to the terms of
+ the GNU General Public License, incorporated herein by reference.
+*/
+
+#ifndef _HG_REVLOG_H_
+#define _HG_REVLOG_H_
+
+#include <Python.h>
+
+extern PyTypeObject indexType;
+
+#endif /* _HG_REVLOG_H_ */
--- a/setup.py	Sun Dec 02 21:33:43 2018 +0900
+++ b/setup.py	Sun Dec 02 21:37:42 2018 +0900
@@ -968,6 +968,7 @@
                   'hg-direct-ffi',
                   include_dirs=common_include_dirs,
                   depends=common_depends + ['mercurial/cext/charencode.h',
+                                            'mercurial/cext/revlog.h',
                                             'rust/hg-core/src/ancestors.rs',
                                             'rust/hg-core/src/lib.rs']),
     Extension('mercurial.cext.osutil', ['mercurial/cext/osutil.c'],