changeset 16028:922c0e9b40be stable

mq: take mq.secret configuration into account when picking the default phase
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 30 Jan 2012 17:39:05 +0100
parents 29ea059be33c
children ee1c8385e5b0
files hgext/mq.py tests/test-mq.t
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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