[PATCH 06 of 10] mq: take mq.secret configuration into account when picking the default phase

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Jan 30 10:49:40 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1327941545 -3600
# Branch stable
# Node ID 333e923770884d2adf04668644bb7444fa7c6e27
# Parent  c317f84ac6bbb26a4b6010959282d7d4a196da9c
mq: take mq.secret configuration into account when picking the default phase

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3157,12 +3157,16 @@ def qqueue(ui, repo, name=None, **opts):
         _setactive(name)
 
 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):
     class mqrepo(repo.__class__):
         @util.propertycache
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1446,6 +1446,21 @@ insensitive filesystem is not enough:
   applying add-file1
   applying add-file2
   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


More information about the Mercurial-devel mailing list