mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
with: use context manager for wlock in _kwfwrite
This commit is contained in:
parent
a2f04de9b6
commit
82870250ec
@ -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')),
|
||||
|
Loading…
Reference in New Issue
Block a user