dirstate: use `dirstate.change_files` to scope the change in `addremove`
This is the way.
--- a/mercurial/commands.py Tue Dec 13 12:57:38 2022 +0100
+++ b/mercurial/commands.py Tue Dec 13 15:07:32 2022 +0100
@@ -331,7 +331,7 @@
opts = pycompat.byteskwargs(opts)
if not opts.get(b'similarity'):
opts[b'similarity'] = b'100'
- with repo.wlock():
+ with repo.wlock(), repo.dirstate.changing_files(repo):
matcher = scmutil.match(repo[None], pats, opts)
relative = scmutil.anypats(pats, opts)
uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative)