hgext/largefiles/overrides.py
changeset 27821 bf3bf7158f69
parent 27772 00bd72629a45
child 27822 bce0afa1921a
--- a/hgext/largefiles/overrides.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/hgext/largefiles/overrides.py	Fri Jan 15 13:14:46 2016 -0800
@@ -141,8 +141,7 @@
 
     # Need to lock, otherwise there could be a race condition between
     # when standins are created and added to the repo.
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         if not opts.get('dry_run'):
             standins = []
             lfdirstate = lfutil.openlfdirstate(ui, repo)
@@ -161,8 +160,6 @@
                     if f in m.files()]
 
         added = [f for f in lfnames if f not in bad]
-    finally:
-        wlock.release()
     return added, bad
 
 def removelargefiles(ui, repo, isaddremove, matcher, **opts):