# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID 476e402e57c3a7cc3a0e960571239826d48f6db1 # Parent 98391f38ceb85d9cfe023a66887490a45b8de546 with: use context manager for wlock in kw_amend diff -r 98391f38ceb8 -r 476e402e57c3 hgext/keyword.py --- a/hgext/keyword.py Fri Jan 15 13:14:46 2016 -0800 +++ b/hgext/keyword.py Fri Jan 15 13:14:46 2016 -0800 @@ -653,8 +653,7 @@ def kw_amend(orig, ui, repo, commitfunc, old, extra, pats, opts): '''Wraps cmdutil.amend expanding keywords after amend.''' - wlock = repo.wlock() - try: + with repo.wlock(): kwt.postcommit = True newid = orig(ui, repo, commitfunc, old, extra, pats, opts) if newid != old.node(): @@ -663,8 +662,6 @@ kwt.overwrite(ctx, ctx.files(), False, True) kwt.restrict = False return newid - finally: - wlock.release() def kw_copy(orig, ui, repo, pats, opts, rename=False): '''Wraps cmdutil.copy so that copy/rename destinations do not