# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID bf3bf7158f69c28142d048a705d3cc4ef825815a # Parent d2e9cc9edc08b54fc3cef8087aa1041841b06fea with: use context manager for wlock in addlargefiles diff -r d2e9cc9edc08 -r bf3bf7158f69 hgext/largefiles/overrides.py --- 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 @@ -141,8 +141,7 @@ # Need to lock, otherwise there could be a race condition between # when standins are created and added to the repo. - wlock = repo.wlock() - try: + with repo.wlock(): if not opts.get('dry_run'): standins = [] lfdirstate = lfutil.openlfdirstate(ui, repo) @@ -161,8 +160,6 @@ if f in m.files()] added = [f for f in lfnames if f not in bad] - finally: - wlock.release() return added, bad def removelargefiles(ui, repo, isaddremove, matcher, **opts):