<?xml version="1.0" encoding="ISO-8859-15"?>
<rss version="2.0"><channel>
<title>making a combined diff of many subversion commits</title>
<link>http://sange.fi/~atehwa/cgi-bin/piki.cgi/</link>
<description>Recent changes in making a combined diff of many subversion commits</description>
<item><title>making a combined diff of many subversion commits</title>
<link>http://sange.fi/~atehwa/cgi-bin/piki.cgi/making%20a%20combined%20diff%20of%20many%20subversion%20commits</link>
<guid>http://sange.fi/~atehwa/cgi-bin/piki.cgi/#1486565262</guid>
<description>&lt;p&gt;&lt;ins&gt;(nettipäiväkirja 08.02.2017) Branching in [subversion] is 
somewhat more cumbersome than, say, in [Git] or [darcs], so some 
programming shops run the practice of not using branches for features 
and just tagging all commits to some feature in the commit message. 
It's fine, and it significantly reduces the pain of merges (by keeping 
the merges small), but it does make code reviews sometimes hard. The 
worst case is when you have to review a long-running feature 
pseudo-branch with commits interspersed with other commits.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;Stack Overflow tells us that Intellij IDEA has something to 
combine the diffs 
(http://stackoverflow.com/questions/466195/seeing-a-combined-diff-of-man
y-commits-in-subversion), but if it really does, I've never been able 
to find this functionality. Instead, I did what the people in the 
thread suggested: write a script that takes the patches of multiple 
commits, splits them, and combines them so that changes to the same 
line(s) are merged.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;It's not foolproof, since the changes in between (that do not 
belong to the pseudo-branch) might offset the changes in the patches. 
However, this actually works pretty well for most cases. The only other 
option I can think of, is to create a new branch for the code review 
and cherry-pick all commits to be reviewed into that branch. I don't 
know about subversion's cherry-picking abilities, but I wouldn't hold 
my breath for the success of this approach. Not to mention that it will 
then clutter your repository with another branch, something you were 
probably trying to avoid if you didn't create that branch in the first 
place.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;Here's the diff-combining script (it uses splitdiff and 
combinediff from patchutils):&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;{{{ #!/bin/bash&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;TAG="$1"&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;mkdir -p tmp&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;test ! -s "tmp/$TAG.diff" \ &amp;&amp; svn log --limit 500 --search 
"$TAG" --diff \ | sed '/^--------*$/,/^========*$/d;/^Index: 
/,/^========*$/d;/^$/d' \ &gt; "tmp/$TAG.diff"&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;(cd tmp &amp;&amp; splitdiff "$TAG.diff") &gt; 
"tmp/$TAG.diff.combined"&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;ls tmp | tac | grep 'diff\.part[0-9]*\.patch$' \ | while read 
PATCH; do echo "Processing $PATCH..." 1&gt;&amp;2 combinediff -q 
"tmp/$TAG.diff.combined" "tmp/$PATCH" \ &gt; "tmp/$PATCH.combined" \ &amp;&amp; 
test -s "tmp/$PATCH.combined" \ &amp;&amp; cp "tmp/$PATCH.combined" 
"tmp/$TAG.diff.combined" done&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;cat "tmp/$TAG.diff.combined" }}}&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;* [merkintä: 2017-02] * [atehwa] * [kategoria: 
päiväkirjamerkintä] * [kategoria: työkalut]&lt;/ins&gt;

</description>
<pubDate>Wed, 08 Feb 2017 14:47:42 +0000</pubDate>
</item>

</channel></rss>
