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

Rafael Fernández López ereslibre at kde.org
Fri Jun 4 21:27:11 CDT 2010


Hello again,

Here is an updated version that makes pass subrepo test. This test was
suffering exactly what this patch fixes.


# HG changeset patch
# User Rafael Fernández López <ereslibre at ereslibre.es>
# Date 1275703057 -7200
# Node ID f065a48476d7a51956726d778540da54929fd2c8
# Parent  e581f3acc3385da5d5ddf547882f274d9f7e5b6d
commit: 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.

Also adapt tests to pass. Here subrepo was expecting an extra "created new head"

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:
diff --git a/tests/test-subrepo.out b/tests/test-subrepo.out
--- a/tests/test-subrepo.out
+++ b/tests/test-subrepo.out
@@ -90,7 +90,6 @@
  source   t
  revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
 committing subrepository t
-created new head
   searching for copies back to rev 2
 resolving manifests
  overwrite None partial False


More information about the Mercurial-devel mailing list