changeset 27825:4692571df9ee

with: use context manager for wlock in overridepurge
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 0e55e93b50b5
children f087b7095381
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
@@ -1223,8 +1223,7 @@
     orig(ui, repo, *dirs, **opts)
     repo.status = oldstatus
 def overriderollback(orig, ui, repo, **opts):
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         before = repo.dirstate.parents()
         orphans = set(f for f in repo.dirstate
                       if lfutil.isstandin(f) and repo.dirstate[f] != 'r')
@@ -1258,8 +1257,6 @@
         for lfile in orphans:
             lfdirstate.drop(lfile)
         lfdirstate.write()
-    finally:
-        wlock.release()
     return result
 
 def overridetransplant(orig, ui, repo, *revs, **opts):