This is an archive of the discontinued Mercurial Phabricator instance.

copy: add experimental support for marking committed copies
ClosedPublic

Authored by martinvonz on Jan 28 2020, 6:51 PM.

Details

Summary

The simplest way I'm aware of to mark a file as copied/moved after
committing is this:

hg uncommit --keep <src> <dest>  # <src> needed for move, but not copy
hg mv --after <src> <dest>
hg amend

This patch teaches hg copy a --at-rev argument to simplify that
into:

hg copy --after --at-rev . <src> <dest>

In addition to being simpler, it doesn't touch the working copy, so it
can easily be used even if the destination file has been modified in
the working copy.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Jan 28 2020, 6:51 PM
martinvonz updated this revision to Diff 19671.Jan 28 2020, 6:55 PM
martinvonz updated this revision to Diff 19697.Jan 29 2020, 6:37 PM

See my comment in D8030, the feature is interresting, but it seems to me that we should implement that through regular amend.

martinvonz updated this revision to Diff 20073.Feb 10 2020, 5:43 PM
martinvonz updated this revision to Diff 20086.Feb 10 2020, 6:30 PM
durin42 accepted this revision.Feb 12 2020, 2:45 PM
durin42 added a subscriber: durin42.

See my comment in D8030, the feature is interresting, but it seems to me that we should implement that through regular amend.

On the one hand that's a thought, but I mostly feel like the functionality belongs in hg copy since that's where I'd look for it.

This revision is now accepted and ready to land.Feb 12 2020, 2:45 PM
martinvonz updated this revision to Diff 20195.Feb 13 2020, 2:09 PM
martinvonz updated this revision to Diff 20206.Feb 13 2020, 6:22 PM

See my comment in D8030, the feature is interresting, but it seems to me that we should implement that through regular amend.

On the one hand that's a thought, but I mostly feel like the functionality belongs in hg copy since that's where I'd look for it.

I am not sure I understand what you mean. What I meant was: adding new copies data seems like the jobs of hg copy but actually updating the working directory parents seems like a job for hg amend. So I would use a combinaison of the two commands to do so.

See my comment on D8030 https://phab.mercurial-scm.org/D8030#120771 This proposed change is part of a much bigger picture that requires wider discussion before we can safely proceed.

(Sorry for the delay this will involves, I wish the idea had explicitly surfaced earlier).

marmoute requested changes to this revision.Feb 13 2020, 6:35 PM
This revision now requires changes to proceed.Feb 13 2020, 6:35 PM
martinvonz retitled this revision from copy: add support for marking committed copies to copy: add experimental support for marking committed copies.Feb 13 2020, 6:53 PM
martinvonz updated this revision to Diff 20208.
martinvonz updated this revision to Diff 20233.Feb 14 2020, 6:19 PM

fixed stale uses of -r in commit message and transient code

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.