I recently set up StatSVN at my workplace. It’s a great tool for getting statistics from your Subversion repository - which in case you didn’t know, has a great deal of rich data regarding your team’s activity that can be extracted by analyzing source code activity. You can get very nice graphs of activity over time, check-in activity by author, churn (the amount of repeated check-in of the same files), proportion of adds versus updates, even things like which days of the week or hours of the day get the most repository activity.

StatSVN is a port of the StatCVS project which (being a port) does the exact same thing over CVS.

Running StatSVN as a one time thing is really simple. You just check out all your source into a directory, then run a SVN log over those files, then run StatSVN using that log file as input, and voila! Instant web site with graphs, reports, an applet to let you drill into the code and visualize the size and update frequency.

Setting up StatSVN to run as part of your nightly or configuration Ant builds is a bit more work, but still not hard. One of the first hurdles to overcome is the fact that Ant does not have built-in support for Subversion, so you need to go get an Ant adapter such as from the Subversion guys or use the distasteful <exec> task in Ant to run SVN as a native executable in order to check out a clean set of the code from the repository to your build machine. As it turns out, you need to do the <exec> task anyway because Subversion’s SVN tasks for Ant do not support the log command - which you need to run StatSVN. So getting the SVN tasks for Ant is really kinda pointless, unless you like keeping your use of the <exec> task to an absolute minimum.

Also, be advised that while StatSVN runs quite quickly in analyzing your log file and producing the reports, it could be a slow process to checkout your source code from subversion and run a log. This of course will depend on the size and age of your repository…but it’s still almost certainly not something you want to run everytime you build, even in a continuous integration system such as Hudson (which also rocks).

Anyway, if you’re a metric junkie like me who loves tools that analyze what you and your teammates do for a living, check out StatSVN. Team that up with Hudson, JUnit, PMD, and Emma, and you’ll get a wealth of information about your shop. And as they say, you can’t manage what you can’t measure.

3 Responses to “StatSVN rocks”
  1. The Disco Blog » Blog Archive » The weekly bag– Feb 22 says:

    [...] StatSVN rocks- Indeed it does, baby! [...]

  2. jeff says:

    Can StatSVN give me disk space usage? If not how can I gather that kind of information?

    -jp

  3. Matt says:

    StatSVN has directory statistics available showing you lines of code by directory, including cool pie charts and other graphs (see http://www.statsvn.org/statsvn/dir_sizes.html#Directory_Sizes)

    It does not, however, report things as bytes or KB of disk usage. The means of doing that would depend on what server and os your subversion installation is running on.

Leave a Reply