diff -r 60ea60fea5f3 -r 4ff0e2347ae6 mercurial/phases.py --- a/mercurial/phases.py Fri Jan 15 13:14:49 2016 -0800 +++ b/mercurial/phases.py Fri Jan 15 13:14:49 2016 -0800 @@ -409,12 +409,8 @@ 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: - try: - tr = repo.transaction('pushkey-phase') + with repo.transaction('pushkey-phase') as tr: advanceboundary(repo, tr, newphase, [bin(nhex)]) - tr.close() - finally: - tr.release() return 1 elif currentphase == newphase: # raced, but got correct result