with: use context manager for wlock in keyword demo

This commit is contained in:
Bryan O'Sullivan 2016-01-15 13:14:46 -08:00
parent 82870250ec
commit 6b60d65449

View File

@ -444,11 +444,8 @@ def demo(ui, repo, *args, **opts):
repo[None].add([fn])
ui.note(_('\nkeywords written to %s:\n') % fn)
ui.note(keywords)
wlock = repo.wlock()
try:
with repo.wlock():
repo.dirstate.setbranch('demobranch')
finally:
wlock.release()
for name, cmd in ui.configitems('hooks'):
if name.split('.', 1)[0].find('commit') > -1:
repo.ui.setconfig('hooks', name, '', 'keyword')