svnsmartsvn

Generating an SVN diff file for every changed file in a revision


At my current employer, before a major build our project lead often requests a diff file for every single file that we've revised (to send him a .zip file). SmartSVN is handy for exporting an HTML diff file, however I haven't seen a way to recursively generate one for every file in a commit/revision. I have a feeling this may be possible through the command line, however I haven't found that either. I would like to build a script (perhaps in Python) that would recursively generate a diff file for every changed file in a revision rather than having to do every single file individually.

Does a tool like this currently exist? If not, what command line tools/parameters can help get me there? Thanks!


Solution

  • If you only need the diff, but don't care about having one diff-per-file, then just redirect the output of svn diff, e.g.

    svn diff -c myrevision path/to/repo > mydiff.patch
    

    If you really need a diff for each file, you can parse the output of svn log to create a diff for each file, e.g.

    for f in `svn log -qvr myrevision path/to/repo | grep " *[AMD]" | awk '{print $2}'`; do svn diff -c myrevision path/to/repo/$f > "`basename $f`.patch"; done
    

    This will save the diff for each file under the files base name + .patch.