tags:

views:

282

answers:

6

I have been asked to review the changes made in SVN revision number 123, 178, 199, 245 and 288 - which are all the commits related to a specific feature. What is the reasonable way to approach this ? I suppose I really want to see the collected diff in some way, but I'm open to suggestions. We're on revision 400 right now.

Edit: I like to know how to do things from the command line in subversion, but any solution that works in eclipse or intellij idea (or any separate application) is also welcome. I'm also deliberately open on what I can realistically hope to automate/get tool support for since I really don't see how to do this in a smart way.

+2  A: 

Generate five distinct commits, and combine them all with combinediff from patchutils.

squadette
Would this surpress repeated changes to the same line of code ?
krosenvold
awesome! I never heard of combinediff
orip
> combinediff creates a unified diff that expresses the sum of two diffs.so I believe that yes, it will suppress related changes to the same line of code.
squadette
What if the line number changed because some other commit added or removed text at some other place in the file? combinediff has only the text of the diffs to work from, it cannot possibly combine non-consecutive diffs correctly.
Tgr
A: 

bendin's answer to this question had a function to print the collected diff for all revisions of a file. It could be easily modified to print the collected diff of the revisions you were interested in.

Gordon Wilson
As far as I can see there's nothing even remotely related in that question, or am I missing something that you're seeing ?
krosenvold
edited my answer to state why i thought the other question was useful
Gordon Wilson
gordon - lol quit trying to be a rep whore
gordon - sorry, im just a lil kid stuck in my trolling ways
+1  A: 

You did not specify if you wanted to base the diff's off HEAD, or each successive REV number (which im unsure why you would actually want to do this? (dont commit if you didnt mean it)).


#!/bin/bash
for revision in 123 178 199 245 288;
do
          svn diff http://path/to/svn/file@HEAD http://path/to/svn/file@$revision > $revision.diff
done

please, windows fan boys, downvote me because my answer involves the bash shell and not the windows shell (despite the original post never mentioning an OS)

The "problem" with this is that I have to see the full history of changes/reworks that happened underway. Imagine that all five commits changed the same line of code; when I am reading code I always read full lines - so all the earlier changes can be surpressed.
krosenvold
Im confused by this still. Why would you care about the intermediate solution if a later or more recent commit solves it (hopefully and should be, in a better way)?
And as you suggest I do not care about stuff that's been improved in a later commit. If I diff rev 123 vs HEAD I will see all sorts of things that have been changed in 178 vs HEAD. But there will also be some things in 123 vs HEAD that don't change. This boggles my mind.
krosenvold
+1  A: 

I asked a similar question about extracting relevant changes for code review but didn't get a satisfactory answer. The closest I've come to a solution is to do what I mentioned, create a temporary branch and cherry-pick the interesting commits into that temporary branch. If they combine cleanly, then the whole delta can be reviewed at once. In the event that they don't combine cleanly and rely on another unrelated change, perhaps that means the whole lot should be reviewed all at once anyway.

Greg Hewgill
It's a decent solution, if quite a lot of work ;) The interesting thing is that for review purposes you're usually satisfied with information about which parts of which files have changed - a real diff is really not what I'm looking for. I will always re-read the full code in the changed areas.
krosenvold
+1  A: 

After digging around in IntelliJ idea I found a nice solution to this:

Select Version Control | Show Changes View.

On the left hand side you select repository and click all of the revisions you want to review.

In the right hand pane you will get a list of all the files that are affected by the revisions you have selected. When you choose "diff" you will see the internal changes in the selected changesets. Internal re-works that occur within the commits are not shown (as can be expected)

krosenvold
if i down vote you i would. get off my lawn you damn kids with your damn gui!
LOL ;) +1 to the bash script for this comment.
krosenvold
lol +1 for good sport
@theman_on_vista Just tried the IDEA's solution -- it combines changesets while your script just concatenates them. Give me a script that can do this, and I will use command line :-)
Sasha O
+1  A: 

Even though this question is long over with, I actually wrote out a script today that is along these lines:


#!/bin/bash

REVISIONS=$@
LAST_REVISION="NULL"
MASTER="master"                             # path to WC

for THIS_REVISION in ${REVISIONS[@]};
do 
    if [ "$LAST_REVISION" != "NULL" ];
    then
     svn diff $MASTER -r ${LAST_REVISION}:${THIS_REVISION} --summarize | while read f;  
     do
      echo ${f#* } | sed "s/[a-zA-Z0-9:\/.]*$MASTER\///" >> "$LAST_REVISION-to-$THIS_REVISION.log"
     done
    fi

    LAST_REVISION=$THIS_REVISION
done
and you can call it like "my_diff_script.sh rev1 rev2 rev3 rev4" the output would be:
rev1-to-rev2.log 
rev2-to-rev3.log
rev3-to-rev4.log
Good sport ;) +1. And yes, some of us follow our threads ;)
krosenvold