14

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.

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
krosenvold
  • 75,535
  • 32
  • 152
  • 208

6 Answers6

6

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

squadette
  • 8,177
  • 4
  • 28
  • 39
  • Would this surpress repeated changes to the same line of code ? – krosenvold Jan 21 '09 at 17:57
  • awesome! I never heard of combinediff – orip Jan 21 '09 at 21:18
  • > 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 Jan 22 '09 at 05:27
  • 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 Oct 08 '10 at 08:42
5

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
  • 75,535
  • 32
  • 152
  • 208
2

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.

Community
  • 1
  • 1
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 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 Jan 21 '09 at 20:04
1

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
0

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.

Community
  • 1
  • 1
Gordon Wilson
  • 26,244
  • 11
  • 57
  • 60
0

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 Jan 21 '09 at 17:53
  • 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)? –  Jan 21 '09 at 19:34
  • 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 Jan 21 '09 at 20:01