changeset 27823:37552634a7b9

with: use context manager for wlock in overriderevert
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents bce0afa1921a
children 0e55e93b50b5
files hgext/largefiles/overrides.py
diffstat 1 files changed, 1 insertions(+), 5 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
@@ -717,8 +717,7 @@
     # Because we put the standins in a bad state (by updating them)
     # and then return them to a correct state we need to lock to
     # prevent others from changing them in their incorrect state.
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         lfdirstate = lfutil.openlfdirstate(ui, repo)
         s = lfutil.lfdirstatestatus(lfdirstate, repo)
         lfdirstate.write()
@@ -778,9 +777,6 @@
         lfcommands.updatelfiles(ui, repo, filelist, printmessage=False,
                                 normallookup=True)
 
-    finally:
-        wlock.release()
-
 # after pulling changesets, we need to take some extra care to get
 # largefiles updated remotely
 def overridepull(orig, ui, repo, source=None, **opts):