diff -r a46dfc2b58a3 -r 28dfb2df4ab9 mercurial/scmutil.py --- a/mercurial/scmutil.py Sun Feb 05 15:38:23 2023 +0100 +++ b/mercurial/scmutil.py Wed Feb 15 11:51:58 2023 +0100 @@ -1219,7 +1219,7 @@ ) -def addremove(repo, matcher, prefix, uipathfn, opts=None): +def addremove(repo, matcher, prefix, uipathfn, opts=None, open_tr=None): if opts is None: opts = {} m = matcher @@ -1279,7 +1279,9 @@ repo, m, added + unknown, removed + deleted, similarity, uipathfn ) - if not dry_run: + if not dry_run and (unknown or forgotten or deleted or renames): + if open_tr is not None: + open_tr() _markchanges(repo, unknown + forgotten, deleted, renames) for f in rejected: