changeset 16017:2605fc990725 stable

mq: add secret setting
author Matt Mackall <mpm@selenic.com>
date Sun, 29 Jan 2012 12:59:21 -0600
parents 73da3e2b185f
children ed9f40bc346f
files hgext/mq.py tests/test-mq-qclone-http.t tests/test-mq-safety.t tests/test-mq.t
diffstat 4 files changed, 21 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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