Skip to content
Snippets Groups Projects
Commit 72e4fcb43227 authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

requirements: show all missing features in the error message.

Displaying all missing featureis help people to solve the issue (choosing the
right version, creation the right repo)
parent cae09a39b2d2
No related branches found
No related tags found
No related merge requests found
......@@ -698,7 +698,8 @@
'''Reads and parses .hg/requires and checks if all entries found
are in the list of supported features.'''
requirements = set(opener.read("requires").splitlines())
missings = []
for r in requirements:
if r not in supported:
if not r or not r[0].isalnum():
raise error.RequirementError(_(".hg/requires file is corrupt"))
......@@ -701,7 +702,10 @@
for r in requirements:
if r not in supported:
if not r or not r[0].isalnum():
raise error.RequirementError(_(".hg/requires file is corrupt"))
raise error.RequirementError(_("unknown repository format: "
"requires feature '%s' (upgrade Mercurial)") % r)
missings.append(r)
missings.sort()
if missings:
raise error.RequirementError(_("unknown repository format: "
"requires features '%s' (upgrade Mercurial)") % "', '".join(missings))
return requirements
......@@ -98,7 +98,7 @@
$ echo foo >> foo
$ echo fake >> .hg/requires
$ hg commit -m bla
abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
[255]
$ cd ..
......
......@@ -107,8 +107,8 @@
$ echo fake >> .hg/requires
$ hg id
abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
[255]
$ cd ..
$ hg id test
......@@ -111,7 +111,7 @@
[255]
$ cd ..
$ hg id test
abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
[255]
......@@ -9,5 +9,5 @@
[255]
$ echo indoor-pool > .hg/requires
$ hg tip
abort: unknown repository format: requires feature 'indoor-pool' (upgrade Mercurial)!
abort: unknown repository format: requires features 'indoor-pool' (upgrade Mercurial)!
[255]
......@@ -13,1 +13,5 @@
[255]
$ echo outdoor-pool >> .hg/requires
$ hg tip
abort: unknown repository format: requires features 'indoor-pool', 'outdoor-pool' (upgrade Mercurial)!
[255]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment