##// END OF EJS Templates
mq: have mq create secret changeset only
Pierre-Yves David -
r15926:f9451397 default
parent child Browse files
Show More
@@ -251,6 +251,19 b' class patchheader(object):'
251 ci += 1
251 ci += 1
252 del self.comments[ci]
252 del self.comments[ci]
253
253
254 def secretcommit(repo, *args, **kwargs):
255 """helper dedicated to ensure a commit are secret
256
257 It should be used instead of repo.commit inside the mq source
258 """
259 backup = repo.ui.backupconfig('phases', 'new-commit')
260 try:
261 # ensure we create a secret changeset
262 repo.ui.setconfig('phases', 'new-commit', phases.secret)
263 return repo.commit(*args, **kwargs)
264 finally:
265 repo.ui.restoreconfig(backup)
266
254 class queue(object):
267 class queue(object):
255 def __init__(self, ui, path, patchdir=None):
268 def __init__(self, ui, path, patchdir=None):
256 self.basepath = path
269 self.basepath = path
@@ -553,7 +566,7 b' class queue(object):'
553 ret = hg.merge(repo, rev)
566 ret = hg.merge(repo, rev)
554 if ret:
567 if ret:
555 raise util.Abort(_("update returned %d") % ret)
568 raise util.Abort(_("update returned %d") % ret)
556 n = repo.commit(ctx.description(), ctx.user(), force=True)
569 n = secretcommit(repo, ctx.description(), ctx.user(), force=True)
557 if n is None:
570 if n is None:
558 raise util.Abort(_("repo commit failed"))
571 raise util.Abort(_("repo commit failed"))
559 try:
572 try:
@@ -723,8 +736,8 b' class queue(object):'
723 repo.dirstate.setparents(p1, merge)
736 repo.dirstate.setparents(p1, merge)
724
737
725 match = scmutil.matchfiles(repo, files or [])
738 match = scmutil.matchfiles(repo, files or [])
726 n = repo.commit(message, ph.user, ph.date, match=match, force=True)
739 n = secretcommit(repo, message, ph.user, ph.date, match=match,
727
740 force=True)
728 if n is None:
741 if n is None:
729 raise util.Abort(_("repository commit failed"))
742 raise util.Abort(_("repository commit failed"))
730
743
@@ -958,7 +971,8 b' class queue(object):'
958 if util.safehasattr(msg, '__call__'):
971 if util.safehasattr(msg, '__call__'):
959 msg = msg()
972 msg = msg()
960 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
973 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
961 n = repo.commit(commitmsg, user, date, match=match, force=True)
974 n = secretcommit(repo, commitmsg, user, date, match=match,
975 force=True)
962 if n is None:
976 if n is None:
963 raise util.Abort(_("repo commit failed"))
977 raise util.Abort(_("repo commit failed"))
964 try:
978 try:
@@ -1500,8 +1514,8 b' class queue(object):'
1500
1514
1501 try:
1515 try:
1502 # might be nice to attempt to roll back strip after this
1516 # might be nice to attempt to roll back strip after this
1503 n = repo.commit(message, user, ph.date, match=match,
1517 n = secretcommit(repo, message, user, ph.date, match=match,
1504 force=True)
1518 force=True)
1505 # only write patch after a successful commit
1519 # only write patch after a successful commit
1506 patchf.close()
1520 patchf.close()
1507 self.applied.append(statusentry(n, patchfn))
1521 self.applied.append(statusentry(n, patchfn))
@@ -43,7 +43,7 b' test with recursive collection'
43 adding changesets
43 adding changesets
44 adding manifests
44 adding manifests
45 adding file changes
45 adding file changes
46 added 2 changesets with 2 changes to 2 files
46 added 1 changesets with 1 changes to 1 files
47 requesting all changes
47 requesting all changes
48 adding changesets
48 adding changesets
49 adding manifests
49 adding manifests
@@ -82,7 +82,7 b' test with normal collection'
82 adding changesets
82 adding changesets
83 adding manifests
83 adding manifests
84 adding file changes
84 adding file changes
85 added 2 changesets with 2 changes to 2 files
85 added 1 changesets with 1 changes to 1 files
86 requesting all changes
86 requesting all changes
87 adding changesets
87 adding changesets
88 adding manifests
88 adding manifests
@@ -121,7 +121,7 b' test with old-style collection'
121 adding changesets
121 adding changesets
122 adding manifests
122 adding manifests
123 adding file changes
123 adding file changes
124 added 2 changesets with 2 changes to 2 files
124 added 1 changesets with 1 changes to 1 files
125 requesting all changes
125 requesting all changes
126 adding changesets
126 adding changesets
127 adding manifests
127 adding manifests
@@ -171,6 +171,11 b' Pushing applied patch with --force'
171 $ hg push --force -r default ../forcepush2
171 $ hg push --force -r default ../forcepush2
172 pushing to ../forcepush2
172 pushing to ../forcepush2
173 searching for changes
173 searching for changes
174 no changes found
175 $ hg phase -d 'mq()'
176 $ hg push --force -r default ../forcepush2
177 pushing to ../forcepush2
178 searching for changes
174 adding changesets
179 adding changesets
175 adding manifests
180 adding manifests
176 adding file changes
181 adding file changes
@@ -148,8 +148,12 b' qinit -c should create both files if the'
148 $ hg qnew A
148 $ hg qnew A
149 $ checkundo qnew
149 $ checkundo qnew
150 $ echo foo > foo
150 $ echo foo > foo
151 $ hg phase -r qbase
152 0: secret
151 $ hg add foo
153 $ hg add foo
152 $ hg qrefresh
154 $ hg qrefresh
155 $ hg phase -r qbase
156 0: secret
153 $ hg qnew B
157 $ hg qnew B
154 $ echo >> foo
158 $ echo >> foo
155 $ hg qrefresh
159 $ hg qrefresh
@@ -297,6 +301,8 b' Dump the tag cache to ensure that it has'
297 $ hg qpush
301 $ hg qpush
298 applying test.patch
302 applying test.patch
299 now at: test.patch
303 now at: test.patch
304 $ hg phase -r qbase
305 2: secret
300 $ hg tags > /dev/null
306 $ hg tags > /dev/null
301
307
302 .hg/cache/tags (post qpush):
308 .hg/cache/tags (post qpush):
@@ -1207,6 +1213,11 b' repo with unversioned patch dir'
1207 repo with patches applied
1213 repo with patches applied
1208
1214
1209 $ hg qclone qclonesource qclonedest
1215 $ hg qclone qclonesource qclonedest
1216 requesting all changes
1217 adding changesets
1218 adding manifests
1219 adding file changes
1220 added 1 changesets with 1 changes to 1 files
1210 updating to branch default
1221 updating to branch default
1211 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1222 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1223 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now