comparison mercurial/cmdutil.py @ 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 6cdcab3ae3fa
children ce60c8d4ac87
comparison
equal deleted inserted replaced
50041:1346db77e14d 50042:237e9d2e1c71
2983 # add/remove the files to the working copy if the "addremove" option 2983 # add/remove the files to the working copy if the "addremove" option
2984 # was specified. 2984 # was specified.
2985 matcher = scmutil.match(wctx, pats, opts) 2985 matcher = scmutil.match(wctx, pats, opts)
2986 relative = scmutil.anypats(pats, opts) 2986 relative = scmutil.anypats(pats, opts)
2987 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative) 2987 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative)
2988 if opts.get(b'addremove') and scmutil.addremove( 2988 if opts.get(b'addremove'):
2989 repo, matcher, b"", uipathfn, opts 2989 with repo.dirstate.changing_files(repo):
2990 ): 2990 if scmutil.addremove(repo, matcher, b"", uipathfn, opts) != 0:
2991 raise error.Abort( 2991 m = _(
2992 _(b"failed to mark all new/missing files as added/removed") 2992 b"failed to mark all new/missing files as added/removed"
2993 ) 2993 )
2994 raise error.Abort(m)
2994 2995
2995 # Check subrepos. This depends on in-place wctx._status update in 2996 # Check subrepos. This depends on in-place wctx._status update in
2996 # subrepo.precommit(). To minimize the risk of this hack, we do 2997 # subrepo.precommit(). To minimize the risk of this hack, we do
2997 # nothing if .hgsub does not exist. 2998 # nothing if .hgsub does not exist.
2998 if b'.hgsub' in wctx or b'.hgsub' in old: 2999 if b'.hgsub' in wctx or b'.hgsub' in old: