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

login
register
mail settings
Submitter Jun Wu
Date May 3, 2017, 12:20 a.m.
Message ID <05b7c1fbabfd5d419837.1493770803@x1c>
Download mbox | patch
Permalink /patch/20378/
State Deferred
Headers show

Comments

Jun Wu - May 3, 2017, 12:20 a.m.
# HG changeset patch
# User Jun Wu <quark@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

Patch

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