changeset 50036:bb6eaa65d12a

dirstate: use `dirstate.change_files` to scope the change in `tag` This is the way.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 13 Dec 2022 16:57:41 +0100
parents e356e8b65d70
children 46883d91e2b0
files mercurial/tags.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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(