User Tools

Site Tools


automated_subversion_reports_w:statsvn_and_ant

FIXME Sorry - this page got lost somewhere along the way.

I've pulled up the text from the Wayback Machine. I will dig through my archives and see if I can find the associated screenshots.

Automated Subversion Reports w/StatSVN and Ant

Introduction

StatSVN retrieves information from a Subversion repository and generates various tables and charts describing the project development, e.g. timeline for the lines of code, contribution of each developer etc. The current version of StatSVN generates a static suite of HTML or XDOC documents containing tables and chart images.

Note: In this tutorial I'm using CFEclipse.

Download and Installation

They have a ZIP file you can download which contains a readme.txt and statsvn.jar. Copy the statsvn.jar to your Eclipse Ant plugin directory: C:\eclipse-3.2\plugins\org.apache.ant_1.6.5\lib\

You then need to tell Ant about the new file.

  • Open Eclipse/CFEclipse.
  • Windows > Preferences > Ant > Runtime
  • Now click the Classpath tab
  • Select Ant Home Entries (Default)
  • Click Add External Jar
  • Point it to the new statsvn.jar file
  • Click OK

Next you need to add the following lines to your build.xml so Ant can find the tasks:

<taskdef name="statsvn" classname="net.sf.statsvn.ant.StatSvnTask" />

I placed this right after my project declaration and before my description.

Generate Log File

Now in order to run StatSVN you need a SVN log from your project - we'll automate this as well:

<!-- this will generate a SVN log file from the working copy -->
<target name="buildLog">
	<!-- create a log file for the statsvn to use -->
	<exec executable = "svn"  output = "d:/temp/svn.log">
	    <arg  line = "log D:/wwwroot/myproject --xml -v"/>
	</exec>
	<echo message="SVN log created successfully!"/>
</target>

Adjust the paths above accordingly - I'm assuming you'll have a /temp directory to dump this in…

Create Report

Next lets make the target for the actual report:

<!-- this will use the statsvn plugin to generate a report and copy it to the developement server -->
<target name="buildReport" depends="buildLog">
	    <statsvn
	        path="D:/wwwroot/myproject"
	        log="d:/temp/svn.log"
	        outputDir="d:/temp/report/stats"
	        title="Subversion Report"/>
	<echo message="StatSVN report created successfully!"/>
</target>

Notice the depends=“buildLog” in the target - this will automatically run the 'buildLog' target when you run the report. Read more about depend at the Ant site.

Running Reports

Now simply run the 'buildReport' target!

FIXME Image:Run-ant.gif

FIXME Image:log-output.gif

Next Steps

To clean this up - I'll probably add some tasks to automatically create the /temp directory, as well as clean up any previous reports - maybe ZIP them up for archives?

It would also be easy to copy these reports somewhere on your server so others could easily view them.

Report Examples

Below are a few examples of the reports StatSVN produces.

FIXME Image:reports.gif

Reports Generated

  • Timeline for the lines of code
  • Lines of code for each developer
  • Activity by Clock time
  • Authors Activity
  • Author activity per Module
  • Author Most Recent Commits with links to ViewVc
  • Stats per directory
  • File count
  • Average file size
  • Largest files
  • Files with most revisions
  • Directory Sizes
  • Repository Tags Number of LOC per version.
  • Repository tree with file count and lines of code
  • LOC and Churn the evolution of LOC and the amount of change per day
  • Repo Map the dynamic hierarchical view of your repo for the last 30 days
/home3/thecrumb/public_html/wiki/data/pages/automated_subversion_reports_w/statsvn_and_ant.txt · Last modified: 2011/02/10 19:24 by thecrumb