Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:50 -0800] rev 27868
with: use context manager in amend
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:50 -0800] rev 27867
with: use context manager for transaction in changegroup apply
(This needs some line wrapping due to the additional indent level. -mpm)
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:48 -0800] rev 27866
with: use context manager for transaction in rebase
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:47 -0800] rev 27865
with: use context manager for transaction in qimport
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:47 -0800] rev 27864
with: use context manager for transaction in qfinish
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:47 -0800] rev 27863
with: use context manager for transaction in mercurial_sink
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:47 -0800] rev 27862
transaction: turn a transaction into a Python context manager
This lets us greatly simply acquire/release cycles.
If the block completes without raising an exception, the transaction
is closed.
Code pattern before:
try:
tr = repo.transaction('x')
# zillions of lines of code
tr.close()
finally:
tr.release()
And after:
with tr.transaction('x'):
# ...