changeset 16290:9518cb55c822 stable

qfinish: comply with the phases.new-commit option in secret mode (issue3335) In secret mode qfinished changeset were move to the draft phase in all case[1] without regard to phases.new-commit value This changeset ensure qfinish does not automatically promote a changeset further than the phases.new-commit value. Note: This may also result in qfinished changeset made public if phases.new-commit is set to public. [1] "In all case" where parent have a compatible phase. Qfinish keep never altering phases of changeset not involved in the qfinish.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 24 Mar 2012 12:06:49 +0100
parents aae219a99a6e
children 9952ac7e0968 101c8a1befb1
files hgext/mq.py tests/test-mq.t
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Mar 21 22:16:12 2012 -0400
+++ b/hgext/mq.py	Sat Mar 24 12:06:49 2012 +0100
@@ -843,8 +843,9 @@
         if qfinished and repo.ui.configbool('mq', 'secret', False):
             # only use this logic when the secret option is added
             oldqbase = repo[qfinished[0]]
-            if oldqbase.p1().phase() < phases.secret:
-                phases.advanceboundary(repo, phases.draft, qfinished)
+            tphase = repo.ui.config('phases', 'new-commit', phases.draft)
+            if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase:
+                phases.advanceboundary(repo, tphase, qfinished)
 
     def delete(self, repo, patches, opts):
         if not patches and not opts.get('rev'):
--- a/tests/test-mq.t	Wed Mar 21 22:16:12 2012 -0400
+++ b/tests/test-mq.t	Sat Mar 24 12:06:49 2012 +0100
@@ -1474,6 +1474,22 @@
   1: secret
   2: secret
 
+Test that qfinish respect phases.new-commit setting
+
+  $ echo '[phases]' >> $HGRCPATH
+  $ echo 'new-commit=secret' >> $HGRCPATH
+  $ hg qfinish qbase
+  patch add-file2 finalized without changeset message
+  $ hg phase 'all()'
+  0: draft
+  1: secret
+  2: secret
+
+(restore env for next test)
+
+  $ sed -i.bak -e 's/new-commit=secret//' $HGRCPATH
+  $ hg qimport -r 1 --name  add-file2
+
 Test that qfinish preserve phase when mq.secret=false
 
   $ sed -i.bak -e 's/secret=true/secret=false/' $HGRCPATH