[PATCH 1 of 2 evolve-ext v2] evolve: make split respect rev args passed without --rev or -r
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Feb 1 09:36:58 CST 2016
On 02/01/2016 10:26 AM, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1454321971 28800
> # Mon Feb 01 02:19:31 2016 -0800
> # Node ID 8cf256f9050bca9c6ff190bf732e9ce687818d5f
> # Parent 983f2e4dbe5d4d97d6ca82f6679913d75c1f2577
> evolve: make split respect rev args passed without --rev or -r
>
> Currently, if one runs `hg split .` or `hg split`, it will fail
> with an exception. This happens becuase we only expect revision
> args to be passed as --rev/-r ones and don't treat unnamed args
> properly or add default values if no args are provided.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -2729,15 +2729,12 @@
> tr = wlock = lock = None
> newcommits = []
>
> - revopt = opts.get('rev')
> - if revopt:
> - revs = scmutil.revrange(repo, revopt)
> - if len(revs) != 1:
> - raise error.Abort(_("you can only specify one revision to split"))
> - else:
> - rev = list(revs)[0]
> + revarg = revs or opts.get('rev') or '.'
If I read this patch properly, using `hg split 42 -r 1337` will silently
ignore the 1337 input.
Do I get it right? If so, we should not silently abort but abort with
the message below.
> + revs = scmutil.revrange(repo, revarg)
> + if len(revs) != 1:
> + raise error.Abort(_("you can only specify one revision to split"))
> else:
> - rev = '.'
> + rev = list(revs)[0]
>
> try:
> wlock = repo.wlock()
Also, can you introduce the test in the same changeset as the fix? Thanks.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list