with: use context manager for wlock in mergeupdate
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:47 -0800
changeset 27826 f087b7095381
parent 27825 4692571df9ee
child 27827 a5b168953013
with: use context manager for wlock in mergeupdate
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/hgext/largefiles/overrides.py	Fri Jan 15 13:14:47 2016 -0800
@@ -1337,8 +1337,7 @@
     matcher = kwargs.get('matcher', None)
     # note if this is a partial update
     partial = matcher and not matcher.always()
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         # branch |       |         |
         #  merge | force | partial | action
         # -------+-------+---------+--------------
@@ -1387,8 +1386,6 @@
                                 normallookup=partial)
 
         return result
-    finally:
-        wlock.release()
 
 def scmutilmarktouched(orig, repo, files, *args, **kwargs):
     result = orig(repo, files, *args, **kwargs)