Patchwork [3,of,6,V2] diffhelpers: add version to help detect breaking binary changes

login
register
mail settings
Submitter Jun Wu
Date May 19, 2017, 3:46 p.m.
Message ID <f9661db975a2e410b860.1495208770@x1c>
Download mbox | patch
Permalink /patch/20732/
State Accepted
Headers show

Comments

Jun Wu - May 19, 2017, 3:46 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1493167213 25200
#      Tue Apr 25 17:40:13 2017 -0700
# Node ID f9661db975a2e410b860d919ac6436af72b728c3
# Parent  bd01a5b895000ea8791540098b38ae78bed15a2f
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r f9661db975a2
diffhelpers: add version to help detect breaking binary changes

Patch

diff --git a/mercurial/diffhelpers.c b/mercurial/diffhelpers.c
--- a/mercurial/diffhelpers.c
+++ b/mercurial/diffhelpers.c
@@ -165,4 +165,6 @@  static PyMethodDef methods[] = {
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef diffhelpers_module = {
@@ -186,4 +188,5 @@  PyMODINIT_FUNC PyInit_diffhelpers(void)
 	Py_INCREF(diffhelpers_Error);
 	PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error);
+	PyModule_AddIntConstant(m, "version", version);
 
 	return m;
@@ -193,7 +196,9 @@  PyMODINIT_FUNC
 initdiffhelpers(void)
 {
-	Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
+	PyObject *m;
+	m = Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
 	                                        NULL, NULL);
+	PyModule_AddIntConstant(m, "version", version);
 }
 #endif