[PATCH 2 of 3 V2] commit: creating secret heads should not show a "new heads" warning
Laurent Charignon
lcharignon at fb.com
Sat Dec 26 22:46:34 CST 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1451191453 28800
# Sat Dec 26 20:44:13 2015 -0800
# Node ID edd65810df9b8ddb2c78727d2580b8faea6800a7
# Parent 1721c112f0194a078103b3b673de236b5cd5cd52
commit: creating secret heads should not show a "new heads" warning
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()):
repo.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:
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -429,7 +429,6 @@
$ echo wat >> wat
$ hg add wat
$ hg ci -m 'add wat'
- created new head
$ hg merge 769e8ee8708e
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -590,3 +590,32 @@
crosschecking files in changesets and manifests
checking files
7 files, 8 changesets, 7 total revisions
+
+Check that commiting a secret head does not show the "created new head"
+warning
+
+ $ hg log -G --template "{rev} {phase} {desc}\n"
+ @ 7 public merge B' and E
+ |\
+ | o 6 public B'
+ | |
+ o | 4 public E
+ | |
+ o | 3 public D
+ | |
+ o | 2 public C
+ |/
+ o 1 public B
+ |
+ o 0 public A
+
+
+ $ hg update 6
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ $ touch foo
+ $ hg add foo
+ $ hg commit -m "draft commit"
+ created new head
+ $ touch foo2
+ $ hg add foo2
+ $ hg commit -s -m "secret commit"
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -1583,7 +1583,6 @@
warning: changes are committed in secret phase from subrepository ss
committing subrepository t
warning: changes are committed in secret phase from subrepository s
- created new head
$ hg -R s/ss phase tip
5: secret
$ hg -R s phase tip
More information about the Mercurial-devel
mailing list