changeset 32397:5fc3459d0493

mpatch: add version to help detect breaking binary changes
author Jun Wu <quark@fb.com>
date Tue, 25 Apr 2017 17:38:36 -0700
parents 2f51f4c535d2
children dc51700be00c
files mercurial/mpatch_module.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mpatch_module.c	Tue Apr 25 17:40:13 2017 -0700
+++ b/mercurial/mpatch_module.c	Tue Apr 25 17:38:36 2017 -0700
@@ -160,6 +160,8 @@
 	{NULL, NULL}
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef mpatch_module = {
 	PyModuleDef_HEAD_INIT,
@@ -181,6 +183,7 @@
 					  NULL, NULL);
 	Py_INCREF(mpatch_Error);
 	PyModule_AddObject(m, "mpatchError", mpatch_Error);
+	PyModule_AddIntConstant(m, "version", version);
 
 	return m;
 }
@@ -188,8 +191,10 @@
 PyMODINIT_FUNC
 initmpatch(void)
 {
-	Py_InitModule3("mpatch", methods, mpatch_doc);
+	PyObject *m;
+	m = Py_InitModule3("mpatch", methods, mpatch_doc);
 	mpatch_Error = PyErr_NewException("mercurial.mpatch.mpatchError",
 					  NULL, NULL);
+	PyModule_AddIntConstant(m, "version", version);
 }
 #endif