Mercurial > hg
changeset 50009:115510658219
locking: hold the wlock for the full duration of the "keyword demo"
The risk of racing the demo is low, since it seems to create its own repository
on the fly. However it is clearer and more consistent.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 04 Feb 2023 11:46:57 +0100 |
parents | e859f440daa9 |
children | f93bccadcf42 |
files | hgext/keyword.py |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py Sun Feb 05 16:54:26 2023 +0100 +++ b/hgext/keyword.py Sat Feb 04 11:46:57 2023 +0100 @@ -531,17 +531,17 @@ demoitems(b'keywordmaps', kwmaps.items()) keywords = b'$' + b'$\n$'.join(sorted(kwmaps.keys())) + b'$\n' repo.wvfs.write(fn, keywords) - repo[None].add([fn]) - ui.note(_(b'\nkeywords written to %s:\n') % fn) - ui.note(keywords) with repo.wlock(): + repo[None].add([fn]) + ui.note(_(b'\nkeywords written to %s:\n') % fn) + ui.note(keywords) repo.dirstate.setbranch(b'demobranch') - for name, cmd in ui.configitems(b'hooks'): - if name.split(b'.', 1)[0].find(b'commit') > -1: - repo.ui.setconfig(b'hooks', name, b'', b'keyword') - msg = _(b'hg keyword configuration and expansion example') - ui.note((b"hg ci -m '%s'\n" % msg)) - repo.commit(text=msg) + for name, cmd in ui.configitems(b'hooks'): + if name.split(b'.', 1)[0].find(b'commit') > -1: + repo.ui.setconfig(b'hooks', name, b'', b'keyword') + msg = _(b'hg keyword configuration and expansion example') + ui.note((b"hg ci -m '%s'\n" % msg)) + repo.commit(text=msg) ui.status(_(b'\n\tkeywords expanded\n')) ui.write(repo.wread(fn)) repo.wvfs.rmtree(repo.root)