mq: take mq.secret configuration into account when picking the default phase stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 30 Jan 2012 17:39:05 +0100
branchstable
changeset 16028 922c0e9b40be
parent 16027 29ea059be33c
child 16029 ee1c8385e5b0
mq: take mq.secret configuration into account when picking the default phase
hgext/mq.py
tests/test-mq.t
--- a/hgext/mq.py	Mon Jan 30 17:37:45 2012 +0100
+++ b/hgext/mq.py	Mon Jan 30 17:39:05 2012 +0100
@@ -3159,8 +3159,12 @@
 def mqphasedefaults(repo, roots):
     """callback used to set mq changeset as secret when no phase data exists"""
     if repo.mq.applied:
+        if repo.ui.configbool('mq', 'secret', False):
+            mqphase = phases.secret
+        else:
+            mqphase = phases.draft
         qbase = repo[repo.mq.applied[0].node]
-        roots[phases.secret].add(qbase.node())
+        roots[mqphase].add(qbase.node())
     return roots
 
 def reposetup(ui, repo):
--- a/tests/test-mq.t	Mon Jan 30 17:37:45 2012 +0100
+++ b/tests/test-mq.t	Mon Jan 30 17:39:05 2012 +0100
@@ -1448,4 +1448,19 @@
   applying modify-file
   now at: modify-file
 
-  $ cd ..
+Proper phase default with mq:
+
+1. mq.secret=false
+
+  $ rm .hg/store/phaseroots
+  $ hg phase 'qparent::'
+  0: draft
+  1: draft
+  2: draft
+  $ echo '[mq]' >> $HGRCPATH
+  $ echo 'secret=true' >> $HGRCPATH
+  $ rm -f .hg/store/phaseroots
+  $ hg phase 'qparent::'
+  0: secret
+  1: secret
+  2: secret