##// END OF EJS Templates
mq: ensure all mq commits are made with secretcommit()...
Patrick Mezard -
r16100:24df9338 stable
parent child Browse files
Show More
@@ -257,21 +257,23 b' class patchheader(object):'
257 257 ci += 1
258 258 del self.comments[ci]
259 259
260 def secretcommit(repo, *args, **kwargs):
260 def secretcommit(repo, phase, *args, **kwargs):
261 261 """helper dedicated to ensure a commit are secret
262 262
263 263 It should be used instead of repo.commit inside the mq source
264 264 """
265 if not repo.ui.configbool('mq', 'secret', False):
266 return repo.commit(*args, **kwargs)
267
268 backup = repo.ui.backupconfig('phases', 'new-commit')
265 if phase is None:
266 if repo.ui.configbool('mq', 'secret', False):
267 phase = phases.secret
268 if phase is not None:
269 backup = repo.ui.backupconfig('phases', 'new-commit')
269 270 try:
270 # ensure we create a secret changeset
271 repo.ui.setconfig('phases', 'new-commit', phases.secret)
271 if phase is not None:
272 repo.ui.setconfig('phases', 'new-commit', phase)
272 273 return repo.commit(*args, **kwargs)
273 274 finally:
274 repo.ui.restoreconfig(backup)
275 if phase is not None:
276 repo.ui.restoreconfig(backup)
275 277
276 278 class queue(object):
277 279 def __init__(self, ui, path, patchdir=None):
@@ -575,7 +577,7 b' class queue(object):'
575 577 ret = hg.merge(repo, rev)
576 578 if ret:
577 579 raise util.Abort(_("update returned %d") % ret)
578 n = secretcommit(repo, ctx.description(), ctx.user(), force=True)
580 n = secretcommit(repo, None, ctx.description(), ctx.user(), force=True)
579 581 if n is None:
580 582 raise util.Abort(_("repo commit failed"))
581 583 try:
@@ -615,7 +617,7 b' class queue(object):'
615 617 # the first patch in the queue is never a merge patch
616 618 #
617 619 pname = ".hg.patches.merge.marker"
618 n = repo.commit('[mq]: merge marker', force=True)
620 n = secretcommit(repo, None, '[mq]: merge marker', force=True)
619 621 self.removeundo(repo)
620 622 self.applied.append(statusentry(n, pname))
621 623 self.applieddirty = True
@@ -746,7 +748,7 b' class queue(object):'
746 748
747 749 match = scmutil.matchfiles(repo, files or [])
748 750 oldtip = repo['tip']
749 n = secretcommit(repo, message, ph.user, ph.date, match=match,
751 n = secretcommit(repo, None, message, ph.user, ph.date, match=match,
750 752 force=True)
751 753 if repo['tip'] == oldtip:
752 754 raise util.Abort(_("qpush exactly duplicates child changeset"))
@@ -987,7 +989,7 b' class queue(object):'
987 989 if util.safehasattr(msg, '__call__'):
988 990 msg = msg()
989 991 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
990 n = secretcommit(repo, commitmsg, user, date, match=match,
992 n = secretcommit(repo, None, commitmsg, user, date, match=match,
991 993 force=True)
992 994 if n is None:
993 995 raise util.Abort(_("repo commit failed"))
@@ -1539,15 +1541,11 b' class queue(object):'
1539 1541
1540 1542 try:
1541 1543 # might be nice to attempt to roll back strip after this
1542 backup = repo.ui.backupconfig('phases', 'new-commit')
1543 try:
1544 # Ensure we create a new changeset in the same phase than
1545 # the old one.
1546 repo.ui.setconfig('phases', 'new-commit', oldphase)
1547 n = repo.commit(message, user, ph.date, match=match,
1548 force=True)
1549 finally:
1550 repo.ui.restoreconfig(backup)
1544
1545 # Ensure we create a new changeset in the same phase than
1546 # the old one.
1547 n = secretcommit(repo, oldphase, message, user, ph.date,
1548 match=match, force=True)
1551 1549 # only write patch after a successful commit
1552 1550 patchf.close()
1553 1551 self.applied.append(statusentry(n, patchfn))
General Comments 0
You need to be logged in to leave comments. Login now