# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID 484895cc0f600c8e102fa513e79486d24667b922 # Parent 476e402e57c3a7cc3a0e960571239826d48f6db1 with: use context manager for wlock in kw_copy diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -673,8 +673,7 @@ def reposetup(ui, repo): For the latter we have to follow the symlink to find out whether its target is configured for expansion and we therefore must unexpand the keywords in the destination.''' - wlock = repo.wlock() - try: + with repo.wlock(): orig(ui, repo, pats, opts, rename) if opts.get('dry_run'): return @@ -694,8 +693,6 @@ def reposetup(ui, repo): candidates = [f for f in repo.dirstate.copies() if 'l' not in wctx.flags(f) and haskwsource(f)] kwt.overwrite(wctx, candidates, False, False) - finally: - wlock.release() def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts): '''Wraps record.dorecord expanding keywords after recording.'''