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

Rafael Fernández López ereslibre at kde.org
Fri Jun 4 17:31:02 CDT 2010


Hello all,

Talking with timeless we found out that the attached script was
showing "created new head" or more, or less times than needed. What we
agreed was that if "created new head" was shown on revision 8, it
should also be shown on revision 5. However the case is that it
shouldn't be shown in any of those, since we aren't creating any heads
(we are merging).

Today tonfa heavily guided me and helped me to provide this patch.
Basically what was happening is that in revision 5b48d819d5f9 this
code was changed, and the message was shown if any parent wasn't in
bheads. This has changed to if all parents aren't in bheads, then it
is a new head.


# HG changeset patch
# User Rafael Fernández López <ereslibre at ereslibre.es>
# Date 1275690154 -7200
# Node ID 11d3257c4fcb8a124205ac598f477728f90e3916
# Parent  e581f3acc3385da5d5ddf547882f274d9f7e5b6d
Fix regression on "creating new head" message being shown when is not
actually the case.

Revision 5b48d819d5f9 introduced this problem, and introduced changes
basically performs
the check "if all your parents are not in branch heads, then show the message".

Heavily guided by tonfa. Thank you.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -766,9 +766,11 @@
     ctx = repo[node]
     parents = ctx.parents()

-    if bheads and [x for x in parents
-                   if x.node() not in bheads and x.branch() == branch]:
-        ui.status(_('created new head\n'))
+    if bheads:
+        nothead = [x for x in parents
+                   if x.node() not in bheads and x.branch() == branch]
+        if len(parents) == len(nothead):
+            ui.status(_('created new head\n'))

     if not opts.get('close_branch'):
         for r in parents:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newheadbug.sh
Type: application/x-sh
Size: 1003 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100605/2466d192/attachment.sh>


More information about the Mercurial-devel mailing list