changeset 27849:900d36a3e4dd

with: use context manager in verify
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 9bda75a0c783
children 49cfddbf54ba
files mercurial/verify.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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