dirstate: use `dirstate.change_files` to scope the change in `tag`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 13 Dec 2022 16:57:41 +0100
changeset 50036 bb6eaa65d12a
parent 50035 e356e8b65d70
child 50037 46883d91e2b0
dirstate: use `dirstate.change_files` to scope the change in `tag` This is the way.
mercurial/tags.py
--- a/mercurial/tags.py	Tue Jan 31 00:05:12 2023 +0100
+++ b/mercurial/tags.py	Tue Dec 13 16:57:41 2022 +0100
@@ -664,8 +664,9 @@
 
     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(