--- a/hgext/mq.py Wed Jan 18 20:00:48 2012 -0600
+++ b/hgext/mq.py Wed Jan 18 16:53:49 2012 +0100
@@ -251,6 +251,19 @@
ci += 1
del self.comments[ci]
+def secretcommit(repo, *args, **kwargs):
+ """helper dedicated to ensure a commit are secret
+
+ It should be used instead of repo.commit inside the mq source
+ """
+ backup = repo.ui.backupconfig('phases', 'new-commit')
+ try:
+ # ensure we create a secret changeset
+ repo.ui.setconfig('phases', 'new-commit', phases.secret)
+ return repo.commit(*args, **kwargs)
+ finally:
+ repo.ui.restoreconfig(backup)
+
class queue(object):
def __init__(self, ui, path, patchdir=None):
self.basepath = path
@@ -553,7 +566,7 @@
ret = hg.merge(repo, rev)
if ret:
raise util.Abort(_("update returned %d") % ret)
- n = repo.commit(ctx.description(), ctx.user(), force=True)
+ n = secretcommit(repo, ctx.description(), ctx.user(), force=True)
if n is None:
raise util.Abort(_("repo commit failed"))
try:
@@ -723,8 +736,8 @@
repo.dirstate.setparents(p1, merge)
match = scmutil.matchfiles(repo, files or [])
- n = repo.commit(message, ph.user, ph.date, match=match, force=True)
-
+ n = secretcommit(repo, message, ph.user, ph.date, match=match,
+ force=True)
if n is None:
raise util.Abort(_("repository commit failed"))
@@ -958,7 +971,8 @@
if util.safehasattr(msg, '__call__'):
msg = msg()
commitmsg = msg and msg or ("[mq]: %s" % patchfn)
- n = repo.commit(commitmsg, user, date, match=match, force=True)
+ n = secretcommit(repo, commitmsg, user, date, match=match,
+ force=True)
if n is None:
raise util.Abort(_("repo commit failed"))
try:
@@ -1500,8 +1514,8 @@
try:
# might be nice to attempt to roll back strip after this
- n = repo.commit(message, user, ph.date, match=match,
- force=True)
+ n = secretcommit(repo, message, user, ph.date, match=match,
+ force=True)
# only write patch after a successful commit
patchf.close()
self.applied.append(statusentry(n, patchfn))
--- a/tests/test-mq-qclone-http.t Wed Jan 18 20:00:48 2012 -0600
+++ b/tests/test-mq-qclone-http.t Wed Jan 18 16:53:49 2012 +0100
@@ -43,7 +43,7 @@
adding changesets
adding manifests
adding file changes
- added 2 changesets with 2 changes to 2 files
+ added 1 changesets with 1 changes to 1 files
requesting all changes
adding changesets
adding manifests
@@ -82,7 +82,7 @@
adding changesets
adding manifests
adding file changes
- added 2 changesets with 2 changes to 2 files
+ added 1 changesets with 1 changes to 1 files
requesting all changes
adding changesets
adding manifests
@@ -121,7 +121,7 @@
adding changesets
adding manifests
adding file changes
- added 2 changesets with 2 changes to 2 files
+ added 1 changesets with 1 changes to 1 files
requesting all changes
adding changesets
adding manifests
--- a/tests/test-mq-safety.t Wed Jan 18 20:00:48 2012 -0600
+++ b/tests/test-mq-safety.t Wed Jan 18 16:53:49 2012 +0100
@@ -171,6 +171,11 @@
$ hg push --force -r default ../forcepush2
pushing to ../forcepush2
searching for changes
+ no changes found
+ $ hg phase -d 'mq()'
+ $ hg push --force -r default ../forcepush2
+ pushing to ../forcepush2
+ searching for changes
adding changesets
adding manifests
adding file changes
--- a/tests/test-mq.t Wed Jan 18 20:00:48 2012 -0600
+++ b/tests/test-mq.t Wed Jan 18 16:53:49 2012 +0100
@@ -148,8 +148,12 @@
$ hg qnew A
$ checkundo qnew
$ echo foo > foo
+ $ hg phase -r qbase
+ 0: secret
$ hg add foo
$ hg qrefresh
+ $ hg phase -r qbase
+ 0: secret
$ hg qnew B
$ echo >> foo
$ hg qrefresh
@@ -297,6 +301,8 @@
$ hg qpush
applying test.patch
now at: test.patch
+ $ hg phase -r qbase
+ 2: secret
$ hg tags > /dev/null
.hg/cache/tags (post qpush):
@@ -1207,6 +1213,11 @@
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