Seeing a combined diff of many commits in subversion?

前端 未结 6 820
死守一世寂寞
死守一世寂寞 2021-02-05 20:23

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

相关标签:
6条回答
  • 2021-02-05 20:41

    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 讨论(0)
  • 2021-02-05 20:43

    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.

    0 讨论(0)
  • 2021-02-05 20:57

    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)

    0 讨论(0)
  • 2021-02-05 20:59

    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.

    0 讨论(0)
  • 2021-02-05 21:01

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

    0 讨论(0)
  • 2021-02-05 21:02

    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)

    0 讨论(0)
提交回复
热议问题