More Subversion statistics goodness
10 May 2007 | Matt Perdeaux | Backend, Subversion
After the rip-roaring success of our initial forays with StatSVN, we thought how convenient it would be to have these useful statistics generated automatically.
So we came up with this batch file:
set vcReposRoot={svn repository root}
set vcStatRoot={statistics site root}
set vcSVNURL={URL of subversion repos}
cd /d %vcReposRoot%
for /d %%a in (*) do (
cd /d %vcStatRoot%
mkdir %%a
del /q %vcStatRoot%\%%a\*.*
cd /d %vcStatRoot%\%%a
svn co %vcSVNURL%/%%a/trunk
svn log -v --xml %vcSVNURL%/%%a > %%a.log
java -jar c:\statsvn\statsvn.jar %vcStatRoot%\%%a\%%a.log %vcStatRoot%\%%a\trunk
)
This little beauty loops through each repository, checks out the trunk into a fresh directory, generates a log file and then runs StatSVN against the generated trunk. The statistics files are written to a directory on our web server on a repository-by-repository basis, meaning we can browse to that directory, click a repository name (directory browsing turned on in Apache) and see all the latest stats.
We run the batch file at the end of the working week, and try not to waste too much of the weekend looking at the stats.