##// END OF EJS Templates
pushkey: wrap pushkey phase movement in a transaction...
Pierre-Yves David -
r22052:793f9276 default
parent child Browse files
Show More
@@ -331,13 +331,16 b' def listphases(repo):'
331 def pushphase(repo, nhex, oldphasestr, newphasestr):
331 def pushphase(repo, nhex, oldphasestr, newphasestr):
332 """List phases root for serialization over pushkey"""
332 """List phases root for serialization over pushkey"""
333 repo = repo.unfiltered()
333 repo = repo.unfiltered()
334 tr = None
334 lock = repo.lock()
335 lock = repo.lock()
335 try:
336 try:
336 currentphase = repo[nhex].phase()
337 currentphase = repo[nhex].phase()
337 newphase = abs(int(newphasestr)) # let's avoid negative index surprise
338 newphase = abs(int(newphasestr)) # let's avoid negative index surprise
338 oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise
339 oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise
339 if currentphase == oldphase and newphase < oldphase:
340 if currentphase == oldphase and newphase < oldphase:
341 tr = repo.transaction('pushkey-phase')
340 advanceboundary(repo, newphase, [bin(nhex)])
342 advanceboundary(repo, newphase, [bin(nhex)])
343 tr.close()
341 return 1
344 return 1
342 elif currentphase == newphase:
345 elif currentphase == newphase:
343 # raced, but got correct result
346 # raced, but got correct result
@@ -345,6 +348,8 b' def pushphase(repo, nhex, oldphasestr, n'
345 else:
348 else:
346 return 0
349 return 0
347 finally:
350 finally:
351 if tr:
352 tr.release()
348 lock.release()
353 lock.release()
349
354
350 def analyzeremotephases(repo, subset, roots):
355 def analyzeremotephases(repo, subset, roots):
General Comments 0
You need to be logged in to leave comments. Login now