with: use context manager in bisect save_state

This commit is contained in:
Bryan O'Sullivan 2016-01-15 13:14:49 -08:00
parent ff05835c28
commit 9e950df349

View File

@ -153,14 +153,11 @@ def load_state(repo):
def save_state(repo, state):
f = repo.vfs("bisect.state", "w", atomictemp=True)
wlock = repo.wlock()
try:
with repo.wlock():
for kind in sorted(state):
for node in state[kind]:
f.write("%s %s\n" % (kind, hex(node)))
f.close()
finally:
wlock.release()
def get(repo, status):
"""