[PATCH 6 of 8] parsers: add _version to help detect breaking binary changes

Jun Wu quark at fb.com
Tue May 2 20:20:03 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1493167410 25200
#      Tue Apr 25 17:43:30 2017 -0700
# Node ID 05b7c1fbabfd5d4198378b32c70abcb48b9c618d
# Parent  54f38c921b4aa125c4cc64f425ca7931617d3bc8
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 05b7c1fbabfd
parsers: add _version to help detect breaking binary changes

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -2855,6 +2855,12 @@ void dirs_module_init(PyObject *mod);
 void manifest_module_init(PyObject *mod);
 
+/* Binary version. When breaking changes are made, bump this number and change
+ * __init__.py, so the module loader can notice and fallback to pure. */
+static const int _version = 1;
+
 static void module_init(PyObject *mod)
 {
+	PyModule_AddIntConstant(mod, "_version", _version);
+
 	/* This module constant has two purposes.  First, it lets us unit test
 	 * the ImportError raised without hard-coding any error text.  This


More information about the Mercurial-devel mailing list