Patchwork policy: define C module versions individually

login
register
mail settings
Submitter Jun Wu
Date May 23, 2017, 6:29 a.m.
Message ID <38a5dabea120ab837ff4.1495520951@x1c>
Download mbox | patch
Permalink /patch/20857/
State Accepted
Headers show

Comments

Jun Wu - May 23, 2017, 6:29 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1495519180 25200
#      Mon May 22 22:59:40 2017 -0700
# Node ID 38a5dabea120ab837ff46484c4752762f4564b39
# Parent  8db2feb04cebc1878c6232dd2650f2c5468d350e
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 38a5dabea120
policy: define C module versions individually

This allows us to bump the version for a single module without changing all
of them.
Jun Wu - May 23, 2017, 6:35 a.m.
This does not take cffi into consideration, although cffi code seems to be a
"TODO" state. Maybe we can figure what to do once cffi is working.

Excerpts from Jun Wu's message of 2017-05-22 23:29:11 -0700:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1495519180 25200
> #      Mon May 22 22:59:40 2017 -0700
> # Node ID 38a5dabea120ab837ff46484c4752762f4564b39
> # Parent  8db2feb04cebc1878c6232dd2650f2c5468d350e
> # Available At https://bitbucket.org/quark-zju/hg-draft 
> #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 38a5dabea120
> policy: define C module versions individually
> 
> This allows us to bump the version for a single module without changing all
> of them.
> 
> diff --git a/mercurial/policy.py b/mercurial/policy.py
> --- a/mercurial/policy.py
> +++ b/mercurial/policy.py
> @@ -71,6 +71,16 @@ def _importfrom(pkgname, modname):
>      return fakelocals[modname]
>  
> +# keep in sync with "version" in C modules
> +_cextversions = {
> +    r'base85': 1,
> +    r'bdiff': 1,
> +    r'diffhelpers': 1,
> +    r'mpatch': 1,
> +    r'osutil': 1,
> +    r'parsers': 1,
> +}
> +
>  def _checkmod(pkgname, modname, mod):
> -    expected = 1  # TODO: maybe defined in table?
> +    expected = _cextversions.get(modname)
>      actual = getattr(mod, r'version', None)
>      if actual != expected:
Yuya Nishihara - May 23, 2017, 1:06 p.m.
On Mon, 22 May 2017 23:29:11 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1495519180 25200
> #      Mon May 22 22:59:40 2017 -0700
> # Node ID 38a5dabea120ab837ff46484c4752762f4564b39
> # Parent  8db2feb04cebc1878c6232dd2650f2c5468d350e
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 38a5dabea120
> policy: define C module versions individually

Queued, thanks.

Patch

diff --git a/mercurial/policy.py b/mercurial/policy.py
--- a/mercurial/policy.py
+++ b/mercurial/policy.py
@@ -71,6 +71,16 @@  def _importfrom(pkgname, modname):
     return fakelocals[modname]
 
+# keep in sync with "version" in C modules
+_cextversions = {
+    r'base85': 1,
+    r'bdiff': 1,
+    r'diffhelpers': 1,
+    r'mpatch': 1,
+    r'osutil': 1,
+    r'parsers': 1,
+}
+
 def _checkmod(pkgname, modname, mod):
-    expected = 1  # TODO: maybe defined in table?
+    expected = _cextversions.get(modname)
     actual = getattr(mod, r'version', None)
     if actual != expected: