changeset 27826:f087b7095381

with: use context manager for wlock in mergeupdate
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 4692571df9ee
children a5b168953013
files hgext/largefiles/overrides.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)