D2013: commit: allow --no-secret to override phases.new-commit setting
spectral (Kyle Lippincott)
phabricator at mercurial-scm.org
Fri Feb 2 23:40:41 UTC 2018
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Previously, if the user had phases.new-commit=secret, there was no way on the
command line to commit as draft. This lets the user specify --no-secret to
request a draft-phase commit (which will work as long as the parent is not
secret; if the parent is secret, the new commit will be as well regardless of
--no-secret being specified).
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2013
AFFECTED FILES
mercurial/commands.py
tests/test-commit.t
CHANGE DETAILS
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -832,3 +832,16 @@
$ cd ..
+Test that --secret/--no-secret make secret/draft commits, regardless of
+phases.new-commit
+
+ $ hg init phasetest
+ $ cd phasetest
+ $ echo foo > foo
+ $ hg --config phases.new-commit=secret commit -qAm 'force draft' --no-secret
+ $ hg phase -r .
+ 0: draft
+ $ echo foo2 >> foo
+ $ hg --config phases.new-commit=draft commit -qAm 'force secret' --secret
+ $ hg phase -r .
+ 1: secret
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1582,8 +1582,9 @@
else:
def commitfunc(ui, repo, message, match, opts):
overrides = {}
- if opts.get('secret'):
- overrides[('phases', 'new-commit')] = 'secret'
+ if opts.get('secret') is not None:
+ overrides[('phases', 'new-commit')] = (
+ 'secret' if opts.get('secret') else 'draft')
baseui = repo.baseui
with baseui.configoverride(overrides, 'commit'):
To: spectral, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list