changeset 27853:9b8a5c6ac176

with: use context manager in bisect save_state
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents a33c1c9e769c
children 55394c6fe74e
files mercurial/hbisect.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hbisect.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/hbisect.py	Fri Jan 15 13:14:49 2016 -0800
@@ -153,14 +153,11 @@
 
 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):
     """