Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:45 -0800] rev 27800
with: use context manager for wlock in _writeactive
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:45 -0800] rev 27799
with: use context manager for wlock in _writerepo
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:50 -0800] rev 27798
sshpeer: make remotelock a context manager
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:45 -0800] rev 27797
lock: turn a lock into a Python context manager
This lets us greatly simply acquire/release cycles.
Code pattern before:
try:
lock = repo.lock()
# zillions of lines of code
finally:
lock.release()
And after:
with repo.lock():
# ...
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:50 -0800] rev 27796
with: use context manager for I/O in changedfiles in patch
Bryan O'Sullivan <bryano@fb.com> [Fri, 15 Jan 2016 13:14:45 -0800] rev 27795
with: use context manager for file I/O in memusage