From 82870250ec79e9205c4b9b41135f542426ceba6d Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Fri, 15 Jan 2016 13:14:46 -0800 Subject: [PATCH] with: use context manager for wlock in _kwfwrite --- hgext/keyword.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hgext/keyword.py b/hgext/keyword.py index 0085b65602..7a8a2577c9 100644 --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -357,14 +357,11 @@ def _kwfwrite(ui, repo, expand, *pats, **opts): 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')),