svnannotationsnantnantcontrib

How to get a recursive svn blame report in a single xml file for all non-binary files in a branch?


How can I get a fully recursive svn blame report for all non-binary files in a branch, where the output is in a single file in xml format and includes revision, date, author, filename & path, and the text of the line of the file itself? The entire output needs to be in a single file. It will be executed as part of the build via a CCNet instance.

Available tools are the latest stable release of nant and nantcontrib, msbuild, and latest command line svn.

Here's some of the issues I have run into: Command line svn blame command does not support directory recursion. Blame's --xml option does not include the actual text of each line, though it does have everything else. By default nantcontrib is passing the --quiet parameter (contrary to the task reference), which is not supported on the blame command. Nantcontrib svn task may not accept the --xml parameter.


Solution

  • The simple answer is that there isn't any easy way to do this. The best, most correct way would be to write your own svn client (or extend the existing one) so that it has the functionality you need. Hardly trivial.

    There's also a wrong way to do it, which also involves writing code. Don't do this:

    find . -type f | grep -v .svn | xargs svn blame > line_data
    
    find . -type f | grep -v .svn | xargs svn --xml blame > xml_data
    

    You could script the two svn commands together to avoid running find twice, but this will still be excruciatingly slow. To add insult to injury, you'll then have to parse the two files yourself to add the actual source lines into the xml data.

    Sadly, I think this is the extent of the support for what you want with the standard svn client, and I can't find any other clients that do things better (some don't even support blame).