[PATCH] Fix "created new head" being shown incorrectly

Rafael Fernández López ereslibre at kde.org
Sat Jun 5 14:04:10 CDT 2010


Hello Gilles and all,

> This would translate to:
>
> diff -r 6ac0d9eaa93c mercurial/commands.py
> --- a/mercurial/commands.py     Wed May 19 17:40:28 2010 +0200
> +++ b/mercurial/commands.py     Sat Jun 05 14:04:10 2010 +0200
> @@ -766,8 +766,8 @@
>     ctx = repo[node]
>     parents = ctx.parents()
>
> -    if bheads and [x for x in parents
> -                   if x.node() not in bheads and x.branch() == branch]:
> +    if bheads and not [x for x in parents
> +                       if x.node() in bheads and x.branch() == branch]:
>         ui.status(_('created new head\n'))
>
>     if not opts.get('close_branch'):
>
>
> But several tests are impacted as well, and I will have to verify that my
> alternative is valid and semantically equivalent to your patch.

It isn't semantically equivalent, and this should print "created new
head" even when we commit node 1, 2 and 3 on the example (every time
we are moving the head, even if there is only one: "o", "o - o", " o -
o - o"), because you print the message if "any" of the parents is on
branch heads, while the patch submitted prints the message if "all"
the parents (the usual case is when you only have one parent, but can
also be a merge) are not in branch heads. This is when we are creating
a new head.


Best regards,
Rafael Fernández López.


More information about the Mercurial-devel mailing list