# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:49 # Node ID 9b8a5c6ac1769d73953685bc2c052e3b2b5dd41c # Parent a33c1c9e769c571c8b049821aa03a4475636dd2c with: use context manager in bisect save_state diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py --- a/mercurial/hbisect.py +++ b/mercurial/hbisect.py @@ -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): """