Mercurial > hg-stable
changeset 14746:72e4fcb43227 stable
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)
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 25 Jun 2011 02:30:24 +0200 |
parents | cae09a39b2d2 |
children | 69021fbf914e 1b8c70c9f47c 7e5b312df988 |
files | mercurial/scmutil.py tests/test-commit.t tests/test-identify.t tests/test-requires.t |
diffstat | 4 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Fri Jun 24 23:29:51 2011 +0200 +++ b/mercurial/scmutil.py Sat Jun 25 02:30:24 2011 +0200 @@ -698,10 +698,14 @@ '''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")) - 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
--- a/tests/test-commit.t Fri Jun 24 23:29:51 2011 +0200 +++ b/tests/test-commit.t Sat Jun 25 02:30:24 2011 +0200 @@ -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 ..
--- a/tests/test-identify.t Fri Jun 24 23:29:51 2011 +0200 +++ b/tests/test-identify.t Sat Jun 25 02:30:24 2011 +0200 @@ -107,11 +107,11 @@ $ 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 - abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)! + abort: unknown repository format: requires features 'fake' (upgrade Mercurial)! [255]
--- a/tests/test-requires.t Fri Jun 24 23:29:51 2011 +0200 +++ b/tests/test-requires.t Sat Jun 25 02:30:24 2011 +0200 @@ -9,5 +9,9 @@ [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] + $ echo outdoor-pool >> .hg/requires + $ hg tip + abort: unknown repository format: requires features 'indoor-pool', 'outdoor-pool' (upgrade Mercurial)! + [255]