qfinish: do not set secret changeset to draft if mq.secret=false stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 30 Jan 2012 15:17:08 +0100
branchstable
changeset 16029 ee1c8385e5b0
parent 16028 922c0e9b40be
child 16030 308406677e9d
qfinish: do not set secret changeset to draft if mq.secret=false If mq.secret=false, mq should not touch phase
hgext/mq.py
tests/test-mq.t
--- 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