with: use context manager in verify
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:49 -0800
changeset 27849 900d36a3e4dd
parent 27848 9bda75a0c783
child 27850 49cfddbf54ba
with: use context manager in verify
mercurial/verify.py
--- a/mercurial/verify.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/mercurial/verify.py	Fri Jan 15 13:14:49 2016 -0800
@@ -22,11 +22,8 @@
 )
 
 def verify(repo):
-    lock = repo.lock()
-    try:
+    with repo.lock():
         return verifier(repo).verify()
-    finally:
-        lock.release()
 
 def _normpath(f):
     # under hg < 2.4, convert didn't sanitize paths properly, so a