[PATCH 1 of 5] mq: wrap qfinish phase movement in a transaction

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Aug 6 03:25:18 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1407311331 25200
#      Wed Aug 06 00:48:51 2014 -0700
# Node ID 7ff215a4cf1c0d452642fa2b820ed84c76b3dc9f
# Parent  8d99c107b0414f68f5c0add2f642b3d576fedcab
mq: wrap qfinish phase movement in a transaction

Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -928,11 +928,16 @@ class queue(object):
         if qfinished and repo.ui.configbool('mq', 'secret', False):
             # only use this logic when the secret option is added
             oldqbase = repo[qfinished[0]]
             tphase = repo.ui.config('phases', 'new-commit', phases.draft)
             if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase:
-                phases.advanceboundary(repo, tphase, qfinished)
+                tr = repo.transaction('qfinish')
+                try:
+                    phases.advanceboundary(repo, tphase, qfinished)
+                    tr.close()
+                finally:
+                    tr.release()
 
     def delete(self, repo, patches, opts):
         if not patches and not opts.get('rev'):
             raise util.Abort(_('qdelete requires at least one revision or '
                                'patch name'))


More information about the Mercurial-devel mailing list