mq: add secret setting stable
authorMatt Mackall <mpm@selenic.com>
Sun, 29 Jan 2012 12:59:21 -0600
branchstable
changeset 16017 2605fc990725
parent 16016 73da3e2b185f
child 16018 ed9f40bc346f
mq: add secret setting
hgext/mq.py
tests/test-mq-qclone-http.t
tests/test-mq-safety.t
tests/test-mq.t
--- a/hgext/mq.py	Sun Jan 29 12:59:11 2012 -0600
+++ b/hgext/mq.py	Sun Jan 29 12:59:21 2012 -0600
@@ -38,6 +38,12 @@
 'no', mq will override the [diff] section and always generate git or
 regular patches, possibly losing data in the second case.
 
+It may be desirable for mq changesets in the secret phase (see
+:hg:`help phases`), which can be enabled with the following setting::
+
+  [mq]
+  secret = True
+
 You will by default be managing a patch queue named "patches". You can
 create other, independent patch queues with the :hg:`qqueue` command.
 '''
@@ -256,6 +262,9 @@
 
     It should be used instead of repo.commit inside the mq source
     """
+    if not repo.ui.configbool('mq', 'secret', False):
+        return repo.commit(*args, **kwargs)
+
     backup = repo.ui.backupconfig('phases', 'new-commit')
     try:
         # ensure we create a secret changeset
--- a/tests/test-mq-qclone-http.t	Sun Jan 29 12:59:11 2012 -0600
+++ b/tests/test-mq-qclone-http.t	Sun Jan 29 12:59:21 2012 -0600
@@ -43,7 +43,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 1 changesets with 1 changes to 1 files
+  added 2 changesets with 2 changes to 2 files
   requesting all changes
   adding changesets
   adding manifests
@@ -82,7 +82,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 1 changesets with 1 changes to 1 files
+  added 2 changesets with 2 changes to 2 files
   requesting all changes
   adding changesets
   adding manifests
@@ -121,7 +121,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 1 changesets with 1 changes to 1 files
+  added 2 changesets with 2 changes to 2 files
   requesting all changes
   adding changesets
   adding manifests
--- a/tests/test-mq-safety.t	Sun Jan 29 12:59:11 2012 -0600
+++ b/tests/test-mq-safety.t	Sun Jan 29 12:59:21 2012 -0600
@@ -144,17 +144,6 @@
 
 Pushing applied patch with --rev without --force
 
-All secret
-
-  $ hg push -r . ../forcepush2
-  pushing to ../forcepush2
-  searching for changes
-  no changes found (ignored 1 secret changesets)
-
-some draft
-
-  $ hg phase --draft 'mq()'
-
   $ hg push -r . ../forcepush2
   pushing to ../forcepush2
   abort: source has mq patches applied
--- a/tests/test-mq.t	Sun Jan 29 12:59:11 2012 -0600
+++ b/tests/test-mq.t	Sun Jan 29 12:59:21 2012 -0600
@@ -50,6 +50,12 @@
   will override the [diff] section and always generate git or regular patches,
   possibly losing data in the second case.
   
+  It may be desirable for mq changesets in the secret phase (see "hg help
+  phases"), which can be enabled with the following setting:
+  
+    [mq]
+    secret = True
+  
   You will by default be managing a patch queue named "patches". You can create
   other, independent patch queues with the "hg qqueue" command.
   
@@ -149,11 +155,11 @@
   $ checkundo qnew
   $ echo foo > foo
   $ hg phase -r qbase
-  0: secret
+  0: draft
   $ hg add foo
   $ hg qrefresh
   $ hg phase -r qbase
-  0: secret
+  0: draft
   $ hg qnew B
   $ echo >> foo
   $ hg qrefresh
@@ -302,7 +308,7 @@
   applying test.patch
   now at: test.patch
   $ hg phase -r qbase
-  2: secret
+  2: draft
   $ hg tags > /dev/null
 
 .hg/cache/tags (post qpush):
@@ -395,7 +401,6 @@
 
 push should fail if draft
 
-  $ hg phase --draft 'mq()'
   $ hg push ../../k
   pushing to ../../k
   abort: source has mq patches applied
@@ -1214,11 +1219,6 @@
 repo with patches applied
 
   $ hg qclone qclonesource qclonedest
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 1 changesets with 1 changes to 1 files
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved