Don't diff merges with SVN

2019-02-26 08:25发布

I would like to get a diff of all the changes I did on a feature branch.

Currently I use

svn log --stop-on-copy | awk '/^r.+NAME/{print $1}' | xargs -l svn diff -c > code.diff

Unfortunately this includes the revisions where trunk got merged into my branch and clutters the diff. Is there a way to get svn log to skipp merges or to get diff to ignore them?

1条回答
Viruses.
2楼-- · 2019-02-26 09:10

As long as you merged all revisions from trunk into your branch you can diff the both trees of trunk (revision of last merge) and branch (head)

Some ascii art to clearify:

                      r6            r9     r11
              --------+-------------+------O-->  branch
             / (1)   / (2)    (3)  /(4)
 trunk -----+-------+--------O----+----------O------>
           r4      r6       r7   r9          r12

(1) you start your branch

(2) you sync your trunk with all commits from trunk

(3) this is a commit on trunk

(4) you must merge the commit of (3) as well (so no missing revisions in trunk which are not merged into branch)

You can then diff branch:r11 with trunk:r9

Note that you cannot diff with trunk:HEAD as then the changes of trunk r12 will be displayed.

This is exactly how reintegrate merge works as well.

查看更多
登录 后发表回答