merge commits and file log history question

Yuya Nishihara yuya at tcha.org
Sat May 19 02:04:52 UTC 2018


On Fri, 18 May 2018 14:00:52 +0200, Jan Heylen wrote:
> * D
> |
> * C (Merge
> |\
> | * B
> |
> * A
> 
> so A and B are normal commits, C is the merge.
> 
> Say, in B a line is added in <file>, while in A that line is not
> present in <file>.
> 
> Now in D, we see the line is not there (so the merge was done with
> taking the version in A.
> 
> If I do:
> 
> hg log -pr C
> I get the full content of the diff in 'C' , and I see indeed the line
> is 'removed' in comparison to 'B'
> 
> but when I do hg log -pr C <file>
> I get no output, as if that <file> wasn't touched.

That's because the file added at 'B' is unchanged in 'C'. 'hg log -rC FILE'
basically means selecting revisions from 'C' where 'FILE' is touched.

> I would like to understand this difference, and if there is way to do
> hg log -p <file>, where the changes done in merge commits are shown.

'hg diff --change REV FILE' could be used to show diff of FILE between
the first parent of REV and REV.



More information about the Mercurial mailing list