[PATCH 4 of 7 v2] rebase: improve error message for empty --source set

Augie Fackler raf at durin42.com
Wed Jan 15 10:05:40 CST 2014


On Wed, Jan 15, 2014 at 03:24:43AM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1384730518 18000
> #      Sun Nov 17 18:21:58 2013 -0500
> # Node ID 3bff26f6716934d0c5257784e857af9c6dfb153c
> # Parent  a259f7b488ab54d37ef1fd0574b583e2c63914fd
> rebase: improve error message for empty --source set

okay, I lied on the other thread - I'm going to take 1 through 4 (inclusive) of this series, and will squint at 5-7 shortly.

>
> Before, it just said 'nothing to rebase' in this case. Now, it aborts
> mentioning the reason: 'empty "source" revision set'.
>
> Specifying revisions that cannot be rebased is a 'soft' error, but specifying
> an empty set deserves an abort that explains exactly what the problem is.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -226,7 +226,11 @@ def rebase(ui, repo, **opts):
>                                         'nothing to rebase'))
>              elif srcf:
>                  src = scmutil.revrange(repo, [srcf])
> +                if not src:
> +                    raise util.Abort(_('empty "source" revision set - '
> +                                       'nothing to rebase'))
>                  rebaseset = repo.revs('(%ld)::', src)
> +                assert rebaseset
>              else:
>                  base = scmutil.revrange(repo, [basef or '.'])
>                  rebaseset = repo.revs(
> diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
> --- a/tests/test-rebase-parameters.t
> +++ b/tests/test-rebase-parameters.t
> @@ -83,6 +83,10 @@ These fail:
>    abort: empty "rev" revision set - nothing to rebase
>    [255]
>
> +  $ hg rebase --source '1 & !1'
> +  abort: empty "source" revision set - nothing to rebase
> +  [255]
> +
>    $ hg rebase
>    nothing to rebase
>    [1]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list