# HG changeset patch # User Bryan O'Sullivan # Date 1452892489 28800 # Node ID 4ff0e2347ae628990fca868a81a81af22e310219 # Parent 60ea60fea5f330332674ecc73a06c77185d8dd51 with: use context manager for transaction in pushphase 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