In mercurial, how to see diff between in a merge changeset and one parent without changes from the other parent?

后端 未结 1 1790
旧巷少年郎
旧巷少年郎 2021-02-08 03:54

Consider this trivial repo:

mkdir temp
cd temp
hg init
echo abc > file1
hg ci -A -m init
echo def >> file1
echo hey > file2
hg ci -A -m A
hg up -r0
e         


        
相关标签:
1条回答
  • 2021-02-08 04:19

    Here's a guess (though I'm not sure if it really does what you want). The command

    $ hg log --template {files} -r <merge-revision>
    

    lists the files, which have been changed by a merge. This output could be used as a list of files for the diff command, to show only the changes you're interested in.

    Applied to your example, the following should show what the merge did with your contributions in revision 1:

    $ hg diff -r 1:3 `hg log --template '{files}' -r 3`
    diff --git a/file1 b/file1
    --- a/file1
    +++ b/file1
    @@ -1,2 +1,2 @@
     abc
    -def
    +ghi
    

    Similarly, the command below should show you how the merge affected your colleague's changes in revision 2:

    $ hg diff -r 2:3 `hg log --template '{files}' -r 3`
    # no output, since your colleague decided to keep her *ghi*
    
    0 讨论(0)
提交回复
热议问题