[PATCH 2 of 2] readrequires: provide easier to understand error message

Matt Mackall mpm at selenic.com
Tue May 31 15:45:30 CDT 2011


On Tue, 2011-05-31 at 19:30 +0200, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1306862185 -7200
> # Node ID a72a4bc16d4733c260d29684847eae24162b2995
> # Parent  91334f1a57fcd51a76704311d2aac52150417215
> readrequires: provide easier to understand error message
> 
> NEW:
> 
>   $ hg id
>   abort: unknown repository format: requires feature 'foo' (upgrade Mercurial)!
> 
> OLD:
> 
>   $ hg id
>   abort: requirement 'foo' not supported!
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -698,6 +698,6 @@
>      requirements = set(opener.read("requires").splitlines())
>      for r in requirements:
>          if r not in supported:
> -            raise error.RequirementError(
> -                _("requirement '%s' not supported") % r)
> +            raise error.RequirementError(_("unknown repository format: "
> +                "requires feature '%s' (upgrade Mercurial)") % r)
>      return requirements
> diff --git a/tests/test-commit.t b/tests/test-commit.t
> --- a/tests/test-commit.t
> +++ b/tests/test-commit.t
> @@ -98,7 +98,7 @@
>    $ echo foo >> foo
>    $ echo fake >> .hg/requires
>    $ hg commit -m bla
> -  abort: requirement 'fake' not supported!
> +  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
>    [255]
>  
>    $ cd ..
> diff --git a/tests/test-identify.t b/tests/test-identify.t
> --- a/tests/test-identify.t
> +++ b/tests/test-identify.t
> @@ -107,11 +107,11 @@
>  
>    $ echo fake >> .hg/requires
>    $ hg id
> -  abort: requirement 'fake' not supported!
> +  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
>    [255]
>  
>    $ cd ..
>    $ hg id test
> -  abort: requirement 'fake' not supported!
> +  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
>    [255]

These are queued, thanks. I've added a follow-up patch that complains
about empty or non-alphanumeric requirements.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list