# HG changeset patch # User Pierre-Yves David # Date 2014-08-06 07:54:58 # Node ID 793f9276aeb9c78366c205ac0351867c72b27595 # Parent e894de232f359e80b8c81df51258b4d0976c05d6 pushkey: wrap pushkey 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/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -331,13 +331,16 @@ def listphases(repo): def pushphase(repo, nhex, oldphasestr, newphasestr): """List phases root for serialization over pushkey""" repo = repo.unfiltered() + tr = None lock = repo.lock() try: currentphase = repo[nhex].phase() newphase = abs(int(newphasestr)) # let's avoid negative index surprise oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise if currentphase == oldphase and newphase < oldphase: + tr = repo.transaction('pushkey-phase') advanceboundary(repo, newphase, [bin(nhex)]) + tr.close() return 1 elif currentphase == newphase: # raced, but got correct result @@ -345,6 +348,8 @@ def pushphase(repo, nhex, oldphasestr, n else: return 0 finally: + if tr: + tr.release() lock.release() def analyzeremotephases(repo, subset, roots):