Reputation: 61875
Given a large codebase and two revisions or revsets (say, a local 'source' and a target) which may or may not share a recent parent and usually contain a large number of non-relevant file deltas;
How can diff output be generated to compare the changes only for files that are modified in the source revset itself?
(This should be the delta between the ancestry; but only for the files contained within the revset.)
Using hg diff -r target -r source
shows all the changes in the ancestry, even for files not modified by the source sevision.
In addition, this should be done without any knowledge of the directory structure.
Upvotes: 0
Views: 220
Reputation: 50190
If I understand correctly, you want a diff between revs source
and target
, but you want to restrict it to the files that were modified in changeset source
. You can do it in two steps (easily assembled into one with an alias or shell script):
List the files modified in source
:
hg log -r source --template '{files}'
This just outputs a list of filenames.
Request a diff for these files:
hg diff -r target -r source $(hg log -r source --template '{files}')
Step 2 is a bash command with "command substitution" $(...)
, which inserts the output of step one. Other methods are possible.
Upvotes: 1
Reputation: 97282
From hg help diff
If only one revision is specified then that revision is compared to the working directory
i.e. you can try hg up $SOURCE; hg diff -r $TARGET
Upvotes: 0