[PATCH 4 of 5] push: wrap local phase movement in a transaction

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1407311655 25200
#      Wed Aug 06 00:54:15 2014 -0700
# Node ID 5140e19e070401f1c2ff560385185f6cb17e7b6d
# Parent  6724ab8cf150f9967ba20b9a6d40b56c2f0aafce
push: wrap local 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/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -575,11 +575,16 @@ def _pushsyncphase(pushop):
                                    % newremotehead)
 
 def _localphasemove(pushop, nodes, phase=phases.public):
     """move <nodes> to <phase> in the local source repo"""
     if pushop.locallocked:
-        phases.advanceboundary(pushop.repo, phase, nodes)
+        tr = pushop.repo.transaction('push-phase-sync')
+        try:
+            phases.advanceboundary(pushop.repo, phase, nodes)
+            tr.close()
+        finally:
+            tr.release()
     else:
         # repo is not locked, do not change any phases!
         # Informs the user that phases should have been moved when
         # applicable.
         actualmoves = [n for n in nodes if phase < pushop.repo[n].phase()]


More information about the Mercurial-devel mailing list