Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 50034:5c9462adc4b9
dirstate: use `dirstate.change_files` to scope the change in `copy`
This is the way, unless we are not actually touching the working copy.
In such cases we don't need to do something.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 31 Jan 2023 00:08:53 +0100 |
parents | 7e71d878c708 |
children | e356e8b65d70 |
comparison
equal
deleted
inserted
replaced
50033:7e71d878c708 | 50034:5c9462adc4b9 |
---|---|
2495 This command takes effect with the next commit by default. | 2495 This command takes effect with the next commit by default. |
2496 | 2496 |
2497 Returns 0 on success, 1 if errors are encountered. | 2497 Returns 0 on success, 1 if errors are encountered. |
2498 """ | 2498 """ |
2499 opts = pycompat.byteskwargs(opts) | 2499 opts = pycompat.byteskwargs(opts) |
2500 with repo.wlock(): | 2500 |
2501 context = repo.dirstate.changing_files | |
2502 rev = opts.get(b'at_rev') | |
2503 ctx = None | |
2504 if rev: | |
2505 ctx = logcmdutil.revsingle(repo, rev) | |
2506 if ctx.rev() is not None: | |
2507 | |
2508 def context(repo): | |
2509 return util.nullcontextmanager() | |
2510 | |
2511 opts[b'at_rev'] = ctx.rev() | |
2512 with repo.wlock(), context(repo): | |
2501 return cmdutil.copy(ui, repo, pats, opts) | 2513 return cmdutil.copy(ui, repo, pats, opts) |
2502 | 2514 |
2503 | 2515 |
2504 @command( | 2516 @command( |
2505 b'debugcommands', | 2517 b'debugcommands', |