How-to diff across a renaming?
Marcos Cruz
mercurial-list at programandala.net
Sun Jan 8 08:54:32 UTC 2023
Is it possible to compare two versions of a file which has been renamed,
across the revision in which it was renamed, and with any diff tool?
Say I have these revisions:
- R0: OLDFILE exists
- R1: hg mv OLDFILE NEWFILE # and then also modify NEWFILE
- R2: NEWFILE exists
In order to compare the changes across the renaming I tried the
following (with `diff` and other tools):
hg diff --from R0 --to R2 NEWFILE # displays only NEWFILE, as added
hg diff --from R0 --to R2 OLDFILE # displays only OLDFILE, as deleted
hg diff --from R2 --to R0 NEWFILE # displays only NEWFILE, as deleted
hg diff --from R2 --to R0 OLDFILE # displays only OLDFILE, as added
Then I noticed this example in `hp help diff`, which reads a cryptic
"with rename info":
________
- compare two historical versions of a directory, with rename info:
hg diff --git --from 1.0 --to 1.2 lib/
________
And tried this, which works fine (it displays the changes from OLDFILE
to NEWFILE):
hg diff --git --from R0 --to R2 NEWFILE
But it seems there's no way to do it with other diff tools, right? `hg
help diffs` and `hg help.config.diff` say nothing about this.
Thanks.
--
Marcos Cruz
http://programandala.net
More information about the Mercurial
mailing list