extensions: include current version in "invalid version" message
It is "not so rare" for the mercurial version to be badly detected at build
time. In such case, version check for extensions gets confused.
To help pinpoint the error, we now include the Mercurial's version number in
the error message.
--- a/mercurial/extensions.py Fri Oct 19 01:07:08 2018 +0200
+++ b/mercurial/extensions.py Fri Apr 20 18:08:54 2018 +0200
@@ -189,8 +189,9 @@
# of Mercurial.
minver = getattr(mod, 'minimumhgversion', None)
if minver and util.versiontuple(minver, 2) > util.versiontuple(n=2):
- ui.warn(_('(third party extension %s requires version %s or newer '
- 'of Mercurial; disabling)\n') % (shortname, minver))
+ msg = _('(third party extension %s requires version %s or newer '
+ 'of Mercurial (current: %s); disabling)\n')
+ ui.warn(msg % (shortname, minver, util.version()))
return
log(' - validating extension tables: %s\n', shortname)
_validatetables(ui, mod)
--- a/tests/test-extension.t Fri Oct 19 01:07:08 2018 +0200
+++ b/tests/test-extension.t Fri Apr 20 18:08:54 2018 +0200
@@ -1510,7 +1510,7 @@
> minimumhgversion = b'3.6'
> EOF
$ hg --config extensions.minversion=minversion1.py version
- (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
+ (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
Mercurial Distributed SCM (version 3.5.2)
(see https://mercurial-scm.org for more information)
@@ -1524,7 +1524,7 @@
> minimumhgversion = b'3.7'
> EOF
$ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
- (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
+ (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
Can load version that is only off by point release
--- a/tests/test-extensions-afterloaded.t Fri Oct 19 01:07:08 2018 +0200
+++ b/tests/test-extensions-afterloaded.t Fri Apr 20 18:08:54 2018 +0200
@@ -87,7 +87,7 @@
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ echo "bar = $basepath/minvers.py" >> .hg/hgrc
$ hg log -r. -T'{rev}\n'
- (third party extension bar requires version 9999.9999 or newer of Mercurial; disabling)
+ (third party extension bar requires version 9999.9999 or newer of Mercurial (current: *); disabling) (glob)
foo.uisetup
foo: bar loaded: False
0
@@ -107,7 +107,7 @@
$ echo "bar = $basepath/minvers.py" >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ hg log -r. -T'{rev}\n'
- (third party extension bar requires version 9999.9999 or newer of Mercurial; disabling)
+ (third party extension bar requires version 9999.9999 or newer of Mercurial (current: *); disabling) (glob)
foo.uisetup
foo: bar loaded: False
0