Mercurial > hg
changeset 27874:4ff0e2347ae6
with: use context manager for transaction in pushphase
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:49 -0800 |
parents | 60ea60fea5f3 |
children | add2ba16430e |
files | mercurial/phases.py |
diffstat | 1 files changed, 1 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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