changeset 27820:d2e9cc9edc08

with: use context manager for wlock in updatelfiles
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents e401dfd79ec7
children bf3bf7158f69
files hgext/largefiles/lfcommands.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/hgext/largefiles/lfcommands.py	Fri Jan 15 13:14:46 2016 -0800
@@ -426,8 +426,7 @@
     ignore, for false) message forcibly".
     '''
     statuswriter = lfutil.getstatuswriter(ui, repo, printmessage)
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         lfdirstate = lfutil.openlfdirstate(ui, repo)
         lfiles = set(lfutil.listlfiles(repo)) | set(lfdirstate)
 
@@ -504,8 +503,6 @@
         if lfiles:
             statuswriter(_('%d largefiles updated, %d removed\n') % (updated,
                 removed))
-    finally:
-        wlock.release()
 
 @command('lfpull',
     [('r', 'rev', [], _('pull largefiles for these revisions'))