Published by breki on 07 Feb 2008 at 03:37 pm
Tracking activity on your project in Subversion
A few months ago I was looking for some way of tracking activity on our new software project. What I wanted is a free and simple tool which could analyze Subversion logs and generate some statistics and graphs on lines of code, commits and similar stuff.
So I did a search on Google, SourceForge and some other search engines and I found two tools: StatSVN and (oddly enough) SvnStat. The latter generates a single HTML page with a collection of statistics graphs on daily commits (here is a sample report), while the former is more sophisticated and does analysis on lines of code, file and directory sizes, commit activity analyzed per hours of day and days of week and other things (see sample report). It even shows a repository heatmap – a clickable hierarchical map of your SVN repository with indicated increases or decreases of lines of code per directory or file.
The biggest difference between them is that StatSVN not only analyzes the SVN log file, but also goes through the latest version of your SVN repository. That’s how it calculates the lines of code in your project, for example.
I decided to use both of them, since they complement each other (SvnStat generates some graphs which the other one does not). I created a batch script and set it to run as a scheduled task on our build server. Here is a generalized version of the script, you have to fill in your specifics (see below):
PATH %PATH%;C:\Program Files\Subversion\bin
svn update <1>
svn log <1> -v –xml –non-interactive ><2>
cd D:\Programs\Development\SvnStat-1.0
java -classpath SvnStat-all.jar de.agentlab.svnstat.SvnStat -jar SvnStat-all.jar -r <2> -d <3>
cd D:\Programs\Development\statsvn-0.3.1
java -jar statsvn.jar -exclude <4> -output-dir <4> -cache-dir cache <2> <1>
<1> = a file path to your checked out repository
<2> = a place where you want to put the SVN XML log file (the whole file path including the name)
<3> = a place where the first (SvnStat) report will be generated
<4> = a place where the second (StateSVN) report will be generated
One warning: the reports also analyze activity for each SVN user, so watch out if you have members in your team that feel that this is a little too Big Brother-ish.



Jean-Philippe Daigle on 07 Feb 2008 at 16:58 #
Good post! If someone feels per-user reporting is a little too Big Brother-ish, you can run StatSVN with the -anonymize command line option, which will still give you all the stats, but replace the committer names with generic ones, like author1, author2, …, authorN.*
*: At least in the statsvn trunk builds, not sure if that feature was in the last official release or not.
Jason Kealey on 08 Feb 2008 at 1:20 #
Thanks for blogging about our tool
breki on 08 Feb 2008 at 8:25 #
Well I think it should be blogged about, since I couldn’t find any posts about this issue. Keep doing the good work!
sangeeth on 31 Dec 2008 at 10:06 #
Hi
This post is just wonderful and serves my purpose absolutely.A million thanks for all the hard work.
Just a comment
-v –xml –non-interactive should be -v –-xml –non-interactive .
The argument –xml and not -xml
Thanks
Sangeeth