# HG changeset patch # User Pierre-Yves David # Date 2022-12-13 15:57:41 # Node ID bb6eaa65d12a980961392018e1881cee37b7308a # Parent e356e8b65d703c58d90f87453c66f97f77742dd0 dirstate: use `dirstate.change_files` to scope the change in `tag` This is the way. diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -664,8 +664,9 @@ def _tag( repo.invalidatecaches() - if b'.hgtags' not in repo.dirstate: - repo[None].add([b'.hgtags']) + with repo.dirstate.changing_files(repo): + if b'.hgtags' not in repo.dirstate: + repo[None].add([b'.hgtags']) m = matchmod.exact([b'.hgtags']) tagnode = repo.commit(