[PATCH 2 of 2] commit: commit should ignore secret heads for "new heads" warning (issue5017)

Yuya Nishihara yuya at tcha.org
Sat Dec 26 07:32:03 CST 2015


On Wed, 23 Dec 2015 11:07:31 -0800, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1450897516 28800
> #      Wed Dec 23 11:05:16 2015 -0800
> # Node ID 9954c27e3d395aad2896e88023fcfbce049eb617
> # Parent  1721c112f0194a078103b3b673de236b5cd5cd52
> commit: commit should ignore secret heads for "new heads" warning (issue5017)
> 
> The warning exists to keep people from having multi-headed push trouble but
> since secret commits are not pushed we don't need to display this warning.
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2807,7 +2807,8 @@
>      parents = ctx.parents()
>  
>      if (not opts.get('amend') and bheads and node not in bheads and not
> -        [x for x in parents if x.node() in bheads and x.branch() == branch]):
> +        [x for x in parents if x.node() in bheads and x.branch() == branch]
> +        and not ctx.secret()):

I think this change is also good, but is different from the issue5017. It says
"bheads" should ignore existing secret revisions.

  0(draft)---1(secret)
   \
    -------------------2(draft)
       new commit 2 shouldn't say "created new head" because 1 is secret
       therefore non-secret bheads are {0}.


More information about the Mercurial-devel mailing list