configwizard: update error message when running too old Mercurial (
bug 1282293); r=glob
By adding the version numbers we let people know what they are running
and what is required.
By adding the URL to install instructions, we hopefully increase the
changes of people installing a modern Mercurial.
MozReview-Commit-ID: CJ27QKX3ALQ
--- a/hgext/configwizard/__init__.py
+++ b/hgext/configwizard/__init__.py
@@ -42,20 +42,25 @@ The wizard makes no changes without your
To begin, press the enter/return key.
'''.lstrip()
MINIMUM_SUPPORTED_VERSION = (3, 5, 0)
OLDEST_NON_LEGACY_VERSION = (3, 7, 3)
VERSION_TOO_OLD = '''
-Your version of Mercurial is too old to run `hg configwizard`.
+Your version of Mercurial (%d.%d) is too old to run `hg configwizard`.
Mozilla's Mercurial support policy is to support at most the past
1 year of Mercurial releases (or 4 major Mercurial releases).
+
+Please upgrade to Mercurial %d.%d or newer and try again.
+
+See https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/installing.html
+for Mozilla-tailored instructions for install Mercurial.
'''.lstrip()
LEGACY_MERCURIAL_MESSAGE = '''
You are running an out of date Mercurial client (%s).
For a faster and better Mercurial experience, we HIGHLY recommend you
upgrade.
@@ -292,17 +297,20 @@ def configwizard(ui, repo, statedir=None
"""Ensure your Mercurial configuration is up to date."""
runsteps = set(wizardsteps)
if ui.hasconfig('configwizard', 'steps'):
runsteps = set(ui.configlist('configwizard', 'steps'))
hgversion = util.versiontuple(n=3)
if hgversion < MINIMUM_SUPPORTED_VERSION:
- ui.warn(VERSION_TOO_OLD)
+ ui.warn(VERSION_TOO_OLD % (
+ hgversion[0], hgversion[1],
+ MINIMUM_SUPPORTED_VERSION[0], MINIMUM_SUPPORTED_VERSION[1],
+ ))
raise error.Abort('upgrade Mercurial then run again')
uiprompt(ui, INITIAL_MESSAGE, default='<RETURN>')
configpaths = [p for p in scmutil.userrcpath() if os.path.exists(p)]
path = configpaths[0] if configpaths else scmutil.userrcpath()[0]
cw = configobjwrapper(path)
--- a/hgext/configwizard/tests/test-legacy-version.t
+++ b/hgext/configwizard/tests/test-legacy-version.t
@@ -76,14 +76,19 @@ Old version will print legacy message an
Too old version will fail outright
$ rm fakeversion.pyc
$ cat >> fakeversion.py << EOF
> util.version = lambda: '3.4.2'
> EOF
$ hg $FAKEVERSION --config configwizard.steps=hgversion configwizard
- Your version of Mercurial is too old to run `hg configwizard`.
+ Your version of Mercurial (3.4) is too old to run `hg configwizard`.
Mozilla's Mercurial support policy is to support at most the past
1 year of Mercurial releases (or 4 major Mercurial releases).
+
+ Please upgrade to Mercurial 3.5 or newer and try again.
+
+ See https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/installing.html
+ for Mozilla-tailored instructions for install Mercurial.
abort: upgrade Mercurial then run again
[255]