Patchwork [4,of,6,V2] mpatch: 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 <1cf8daf6404e811cf222.1495208771@x1c>
Download mbox | patch
Permalink /patch/20729/
State Accepted
Headers show

Comments

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

Patch

diff --git a/mercurial/mpatch_module.c b/mercurial/mpatch_module.c
--- a/mercurial/mpatch_module.c
+++ b/mercurial/mpatch_module.c
@@ -161,4 +161,6 @@  static PyMethodDef methods[] = {
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef mpatch_module = {
@@ -182,4 +184,5 @@  PyMODINIT_FUNC PyInit_mpatch(void)
 	Py_INCREF(mpatch_Error);
 	PyModule_AddObject(m, "mpatchError", mpatch_Error);
+	PyModule_AddIntConstant(m, "version", version);
 
 	return m;
@@ -189,7 +192,9 @@  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