# HG changeset patch # User Pierre-Yves David # Date 2023-01-25 11:46:46 # Node ID 1346db77e14da5783e2353c91403713542fbde55 # Parent d41960df197e654ed2e05bb3a98d3f165a60854c dirstate: use the `changing_files` context in the `keyword` demo This is the way. diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -532,7 +532,8 @@ def demo(ui, repo, *args, **opts): keywords = b'$' + b'$\n$'.join(sorted(kwmaps.keys())) + b'$\n' repo.wvfs.write(fn, keywords) with repo.wlock(): - repo[None].add([fn]) + with repo.dirstate.changing_files(repo): + repo[None].add([fn]) ui.note(_(b'\nkeywords written to %s:\n') % fn) ui.note(keywords) repo.dirstate.setbranch(b'demobranch')