commit: fix display of 'created new head' message (issue2186)
To avoid recurrent fixes for the display of this message, a summary table with
all case combinations has been added to the code.
Basically, there is two condition for the message to be printed:
* this is not an initial (named branch or topo) root
* none of the parents are in the current branch heads
--- a/mercurial/commands.py Tue Jun 08 18:01:07 2010 +0200
+++ b/mercurial/commands.py Tue Jun 08 22:28:42 2010 +0200
@@ -766,9 +766,37 @@
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'))
+ # The message is not printed for initial roots. For the other
+ # changesets, it is printed in the following situations:
+ #
+ # Par column: for the 2 parents with ...
+ # N: null or no parent
+ # B: parent is on another named branch
+ # C: parent is a regular non head changeset
+ # H: parent was a branch head of the current branch
+ # Msg column: whether we print "created new head" message
+ # In the following, it is assumed that there already exists some
+ # initial branch heads of the current branch, otherwise nothing is
+ # printed anyway.
+ #
+ # Par Msg Comment
+ # NN y additional topo root
+ #
+ # BN y additional branch root
+ # CN y additional topo head
+ # HN n usual case
+ #
+ # BB y weird additional branch root
+ # CB y branch merge
+ # HB n merge with named branch
+ #
+ # CC y additional head from merge
+ # CH n merge with a head
+ #
+ # HH n head merge: head count decreases
if not opts.get('close_branch'):
for r in parents:
--- a/tests/test-backout.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-backout.out Tue Jun 08 22:28:42 2010 +0200
@@ -73,6 +73,7 @@
marked working directory as branch branch2
adding file2
removing file1
+created new head
changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
the backout changeset is a new head - do not forget to merge
(use "backout --merge" if you want to auto-merge)
--- a/tests/test-branch-option.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-branch-option.out Tue Jun 08 22:28:42 2010 +0200
@@ -17,6 +17,7 @@
marked working directory as branch æ
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch b
+created new head
in rev c branch a
1:dd6e60a716c6
2:f25d57ab0566
--- a/tests/test-fetch.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-fetch.out Tue Jun 08 22:28:42 2010 +0200
@@ -182,6 +182,7 @@
adding b
marked working directory as branch default
adding c
+created new head
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% fetch should succeed
--- a/tests/test-newbranch.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-newbranch.out Tue Jun 08 22:28:42 2010 +0200
@@ -4,6 +4,7 @@
% branch shadowing
abort: a branch of the same name already exists (use 'hg update' to switch to it)
marked working directory as branch default
+created new head
% there should be only one default branch head
changeset: 3:bf1bc2f45e83
tag: tip
--- a/tests/test-push-warn.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-push-warn.out Tue Jun 08 22:28:42 2010 +0200
@@ -279,8 +279,10 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch B
+created new head
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch A
+created new head
%% glog of local
@ 5: A b3
|
--- a/tests/test-subrepo.out Tue Jun 08 18:01:07 2010 +0200
+++ b/tests/test-subrepo.out Tue Jun 08 22:28:42 2010 +0200
@@ -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