# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID d2e9cc9edc08b54fc3cef8087aa1041841b06fea # Parent e401dfd79ec76796bd46d0ff0be53a519d8abaeb with: use context manager for wlock in updatelfiles diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -426,8 +426,7 @@ def updatelfiles(ui, repo, filelist=None 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 @@ def updatelfiles(ui, repo, filelist=None if lfiles: statuswriter(_('%d largefiles updated, %d removed\n') % (updated, removed)) - finally: - wlock.release() @command('lfpull', [('r', 'rev', [], _('pull largefiles for these revisions'))