# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 2016-01-15 21:14:46
# Node ID 0e55e93b50b5bbbccd1a2d4ff25b52b6124a839a
# Parent  37552634a7b938f35eb64e1e12a7eb65820bec13

with: use context manager for wlock in cmdutilforget

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1053,8 +1053,7 @@ def cmdutilforget(orig, ui, repo, match,
 
     # 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 @@ def cmdutilforget(orig, ui, repo, match,
         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)