# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID 16cfbbc698001b1ab2dd2c6695797b97b083dcb1 # Parent a7273502833612a65d86ea9bee521197338a048d with: use context manager for wlock in _kwfwrite diff -r a72735028336 -r 16cfbbc69800 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 @@ -357,14 +357,11 @@ if len(wctx.parents()) > 1: raise error.Abort(_('outstanding uncommitted merge')) kwt = kwtools['templater'] - wlock = repo.wlock() - try: + with repo.wlock(): status = _status(ui, repo, wctx, kwt, *pats, **opts) if status.modified or status.added or status.removed or status.deleted: raise error.Abort(_('outstanding uncommitted changes')) kwt.overwrite(wctx, status.clean, True, expand) - finally: - wlock.release() @command('kwdemo', [('d', 'default', None, _('show default keyword template maps')),