##// END OF EJS Templates
with: use context manager for lock in pushphase
Bryan O'Sullivan -
r27861:3315a9c2 default
parent child Browse files
Show More
@@ -404,26 +404,23 b' def listphases(repo):'
404 404 def pushphase(repo, nhex, oldphasestr, newphasestr):
405 405 """List phases root for serialization over pushkey"""
406 406 repo = repo.unfiltered()
407 tr = None
408 lock = repo.lock()
409 try:
407 with repo.lock():
410 408 currentphase = repo[nhex].phase()
411 409 newphase = abs(int(newphasestr)) # let's avoid negative index surprise
412 410 oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise
413 411 if currentphase == oldphase and newphase < oldphase:
414 tr = repo.transaction('pushkey-phase')
415 advanceboundary(repo, tr, newphase, [bin(nhex)])
416 tr.close()
412 try:
413 tr = repo.transaction('pushkey-phase')
414 advanceboundary(repo, tr, newphase, [bin(nhex)])
415 tr.close()
416 finally:
417 tr.release()
417 418 return 1
418 419 elif currentphase == newphase:
419 420 # raced, but got correct result
420 421 return 1
421 422 else:
422 423 return 0
423 finally:
424 if tr:
425 tr.release()
426 lock.release()
427 424
428 425 def analyzeremotephases(repo, subset, roots):
429 426 """Compute phases heads and root in a subset of node from root dict
General Comments 0
You need to be logged in to leave comments. Login now