changeset 27822:bce0afa1921a

with: use context manager for wlock in removelargefiles
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents bf3bf7158f69
children 37552634a7b9
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:46 2016 -0800
@@ -196,8 +196,7 @@
 
     # Need to lock because standin files are deleted then removed from the
     # repository and we could race in-between.
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         lfdirstate = lfutil.openlfdirstate(ui, repo)
         for f in sorted(remove):
             if ui.verbose or not m.exact(f):
@@ -228,8 +227,6 @@
                                   False)
 
         lfdirstate.write()
-    finally:
-        wlock.release()
 
     return result