# HG changeset patch # User Pierre-Yves David # Date 2022-12-13 11:57:38 # Node ID 5deac4eaa7d17420cac9bd1ab2c02218844be554 # Parent 28dfb2df4ab949849cd570e6115c728150d5a7cb dirstate: use `dirstate.change_files` to scope the change in `add` This is the way. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -252,7 +252,7 @@ def add(ui, repo, *pats, **opts): Returns 0 if all files are successfully added. """ - with repo.wlock(): + with repo.wlock(), repo.dirstate.changing_files(repo): m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts)) uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) rejected = cmdutil.add(ui, repo, m, b"", uipathfn, False, **opts)