qfinish: do not set secret changeset to draft if mq.secret=false
If mq.secret=false, mq should not touch phase
--- a/hgext/mq.py Mon Jan 30 17:39:05 2012 +0100
+++ b/hgext/mq.py Mon Jan 30 15:17:08 2012 +0100
@@ -826,9 +826,13 @@
return patches
def finish(self, repo, revs):
+ # Manually trigger phase computation to ensure phasedefaults is
+ # executed before we remove the patches.
+ repo._phaserev
patches = self._revpatches(repo, sorted(revs))
qfinished = self._cleanup(patches, len(patches))
- if qfinished:
+ 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)
--- a/tests/test-mq.t Mon Jan 30 17:39:05 2012 +0100
+++ b/tests/test-mq.t Mon Jan 30 15:17:08 2012 +0100
@@ -1464,3 +1464,22 @@
0: secret
1: secret
2: secret
+
+Test that qfinish change phase when mq.secret=true
+
+ $ hg qfinish qbase
+ patch add-file1 finalized without changeset message
+ $ hg phase 'all()'
+ 0: draft
+ 1: secret
+ 2: secret
+
+Test that qfinish preserve phase when mq.secret=false
+
+ $ sed -i'' $HGRCPATH -e 's/secret=true/secret=false/'
+ $ hg qfinish qbase
+ patch add-file2 finalized without changeset message
+ $ hg phase 'all()'
+ 0: draft
+ 1: secret
+ 2: secret