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'):
# ...
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:49 -0800] rev 27861
with: use context manager for lock in pushphase
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:49 -0800] rev 27860
with: use context manager in rebuildfncache again
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:49 -0800] rev 27859
with: use context manager in streamclone consumev1
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:49 -0800] rev 27858
with: use context manager in manifest