D8030: uncopy: add support for unmarking committed copies
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Fri Feb 7 20:47:50 UTC 2020
This revision now requires changes to proceed.
marmoute added a comment.
marmoute requested changes to this revision.
In D8030#119816 <https://phab.mercurial-scm.org/D8030#119816>, @marmoute wrote:
>>> Something like `hg uncopy --after` which makes the changes in wdir which can be committed afterwards sounds best, but I am not sure if that's possible.
>>
>> Yeah, not really possible (Augie had the same comment on one of these patches).
>
> Can we update the dirstate to represent such copy related information ? (both for adding or removing a copy).
Something that really bother me with this kind of command rewriting history is that it can result in an absurd amount of rewrite.
The usual way to change something in mercurial is:
1. get on a clean revision
2. make changes 1
3. make changes 2
4. make changes …
5. make changes 42
6. record the changes (commit, amend, etc…)
If command like `hg copy` start rewriting history, each smallest atomic operation result rewriting one (or multiple) changesets. This is a slippery slope I would rather not walk on.
I think we should explore being able to record this in dirstate and use regular amend to record the change.
INLINE COMMENTS
> cmdutil.py:1707
> + if len(ctx.parents()) > 1:
> + raise error.Abort(_(b'cannot unmark copy in merge commit'))
> + # avoid cycle context -> subrepo -> cmdutil
Why can we do it for merge commit ?
> cmdutil.py:1708
> + raise error.Abort(_(b'cannot unmark copy in merge commit'))
> + # avoid cycle context -> subrepo -> cmdutil
> + from . import context
I prefer this kind of shortcut to be exceptional. Maybe this need to move out of cmdutil ?
> cmdutil.py:1711
> +
> + rewriteutil.precheck(repo, [ctx.rev()], b'uncopy')
> + new_ctx = context.overlayworkingctx(repo)
bonus point for using precheck ☺
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8030/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8030
To: martinvonz, #hg-reviewers, durin42, marmoute
Cc: marmoute, pulkit, durin42, mercurial-devel
More information about the Mercurial-devel
mailing list