[PATCH 2 of 3] graft: warn when -r is combined with revisions as positional arguments

Ryan McElroy rm at fb.com
Sun Jan 17 14:07:27 CST 2016


On 1/17/2016 6:33 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1453055582 -3600
> #      Sun Jan 17 19:33:02 2016 +0100
> # Node ID 0b62abed95818a2e6b3dbdbaa9bf85f1ec5b7194
> # Parent  1fca1cf4ecf3092cbb6ecd5f3357aee4c244b872
> graft: warn when -r is combined with revisions as positional arguments
>
> The behaviour in this case is undefined. Instead of silently doing something
> "random" and surprising, at least issue a warning.

+10 on this patch

>
> (This should perhaps be considered a "deprecation" and turned into an error in
> a future release.)
I'm a big fan of changing the UI to be better, so I'm +1 on this idea, 
but I suspect it might be too radical for the list. I'd love to be wrong 
on that though.

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3889,6 +3889,10 @@ def graft(ui, repo, *revs, **opts):
>           release(wlock)
>   
>   def _dograft(ui, repo, *revs, **opts):
> +    if revs and opts['rev']:
> +        ui.warn(_('warning: inconsistent use of --rev might give unexpected '
> +                  'revision ordering!\n'))
> +
>       revs = list(revs)
>       revs.extend(opts['rev'])
>   
> diff --git a/tests/test-graft.t b/tests/test-graft.t
> --- a/tests/test-graft.t
> +++ b/tests/test-graft.t
> @@ -62,6 +62,7 @@ Specify revisions with -r:
>     [255]
>   
>     $ hg graft -r 1 2
> +  warning: inconsistent use of --rev might give unexpected revision ordering!
>     skipping ancestor revision 2:5c095ad7e90f
>     skipping ancestor revision 1:5d205f8b35b6
>     [255]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list