changeset 27824:0e55e93b50b5

with: use context manager for wlock in cmdutilforget
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 37552634a7b9
children 4692571df9ee
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
@@ -1053,8 +1053,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 forget:
             if lfdirstate[f] == 'a':
@@ -1066,8 +1065,6 @@
         for f in standins:
             util.unlinkpath(repo.wjoin(f), ignoremissing=True)
         rejected = repo[None].forget(standins)
-    finally:
-        wlock.release()
 
     bad.extend(f for f in rejected if f in m.files())
     forgot.extend(f for f in forget if f not in rejected)