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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to