Mercurial > hg
changeset 50042:237e9d2e1c71
dirstate: use `dirstate.change_files` to scope the change in `amend`
This is the way.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 14 Dec 2022 00:47:22 +0100 |
parents | 1346db77e14d |
children | 5cfc48354d0f |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Jan 25 12:46:46 2023 +0100 +++ b/mercurial/cmdutil.py Wed Dec 14 00:47:22 2022 +0100 @@ -2985,12 +2985,13 @@ matcher = scmutil.match(wctx, pats, opts) relative = scmutil.anypats(pats, opts) uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative) - if opts.get(b'addremove') and scmutil.addremove( - repo, matcher, b"", uipathfn, opts - ): - raise error.Abort( - _(b"failed to mark all new/missing files as added/removed") - ) + if opts.get(b'addremove'): + with repo.dirstate.changing_files(repo): + if scmutil.addremove(repo, matcher, b"", uipathfn, opts) != 0: + m = _( + b"failed to mark all new/missing files as added/removed" + ) + raise error.Abort(m) # Check subrepos. This depends on in-place wctx._status update in # subrepo.precommit(). To minimize the risk of this hack, we do