# HG changeset patch # User Jun Wu # Date 2017-05-23 05:59:40 # Node ID 28b773aa3ff26103062cce3664542a4cb535a208 # Parent 8db2feb04cebc1878c6232dd2650f2c5468d350e 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 @@ -70,8 +70,18 @@ def _importfrom(pkgname, modname): getattr(mod, r'__doc__', None) 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: raise ImportError(r'cannot import module %s.%s '