StatCVS Manual

This is the manual for StatCVS, a statistics tool for CVS repositories.

Table of Contents

Prerequisites

To run StatCVS, you need:

Quick Start

It takes three steps to create reports for a CVS module:

  1. Check out a copy of the module from CVS
  2. Create a CVS log for the module
  3. Run StatCVS

Checking out a module from CVS

You can skip this step if you have already checked out a working copy. Typically, the command looks like this (assuming module to be the name of the module):

cvs -d /cvsroot checkout module

Creating a CVS log file

Change into the directory where you have checked out the module, and use the cvs log command to create a log file.

cd module
cvs log > logfile.log

Running StatCVS

StatCVS is run using the command java -jar statcvs.jar. It takes two command line parameters:

java -jar statcvs.jar <logfile> <checked-out-module>

For example:

java -jar /path/to/statcvs.jar /path/to/module/logfile.log /path/to/module

This command creates the reports in the current directory. You can now point your browser to the file index.html, which is the table of contents of the report.

Command Line Options

You can tweak the reports and change the behaviour of StatCVS in various ways using command line options.

java -jar statcvs.jar [options] <logfile> <checked-out-module>

A list of all options understood by StatCVS follows.

-output-dir <directory>

Specify an output directory. The reports will be generated in this directory. The directory will be created if it doesn't exist.

-include <include-pattern-list>
-exclude <exclude-pattern-list>

Specify filters to exclude files from the analysis. A file will be ignored if it doesn't match any of the patterns in include-pattern-list, or if it matches any pattern in exclude-pattern-list.

The patterns are lists of Apache Ant-style wildcard patterns, seperated by colons or semicolons. The wildcards are:

For example, src/**/*.java matches all java files in the src directory or its subdirectories. Note that *.java only matches java files in the root directory, because '*' does not match subdirectories.

One more example:

-include '**/*.c:**/*.h' -exclude 'legacy/**'

This matches all .c and .h files anywhere in the directory tree except those in the legacy directory and its subdirectories.

For more information on Ant's wildcard syntax, see the Patternset section of the Ant manual.

If not specified, all files will be included and no files will be excluded.

Note: Unix users must put the patterns in quotes, or the shell will interfere with the wildcards.

-tags <tags-regularexpression>

Includes information about CVS tags into the reports. Only tags matching the regular expression are included. To include all tags, add -tags '.*' to the command line.

Note: Unix users must put the expression in quotes, or the shell will interfere with the wildcards.

-no-developer <login-name>

Excludes a CVS account name from all developer reports. This is useful to reduce noise from administrative and other non-developer accounts. Multiple accounts can be excluded by adding the option to the command line once for each account.

-title <title>

Specifies a display title to be used in the reports. The name of the CVS module will be used as default if no title is specified.

-css <stylesheet>

Specify a Cascading Style Sheet for the report. This can be a HTTP URL or a local file. A URL will simply be linked in every page of the report. A local file will be copied into the report directory.

-notes <notes-file>

The contents of the specified file will be included at the top of the report's index page. The file should contain a valid block-level HTML fragment, for example:

<p>
  These are development statistics for the
  <a href="http://statcvs.sf.net/">StatCVS</a>
  project, created by StatCVS itself.
</p>
<p>
  <strong>Note:</strong>
  This report was generated by an unreleased
  development version of StatCVS. It might
  contain features not yet found in the
  official release.
</p>
-viewcvs <viewcvs-url>

Specify the URL of a ViewCVS installation for the module. This must be the URL of the page for the module's root directory. StatCVS will create links to ViewCVS for directories, files and revisions.

-viewvc <viewvc-url>

Specify the URL of a ViewVC installation for the module. This must be the URL of the page for the module's root directory. StatCVS will create links to ViewVC for directories, files and revisions.

-cvsweb <cvsweb-url>

Specify the URL of a cvsweb installation for the module. This must be the URL of the page for the module's root directory. StatCVS will create links to cvsweb for directories, files and revisions.

-chora <chora-url>

Specify the URL of a Chora installation for the module. This must be the URL of the page for the module's root directory. StatCVS will create links to Chora for directories, files and revisions.

-jcvsweb <jcvsweb-url>

Specify the URL of a JCVSWeb installation for the module. This must be the URL of the page for the module's root directory. StatCVS will create links to JCVSWeb for directories, files and revisions.

-bugzilla <bugzilla-url>

Specify the root URL of a Bugzilla installation. In commit messages, this will turn “Bug ####” into a link to the appropriate bug.

-mantis <mantis-url>

Specify the root URL of a Mantis bug tracker installation. In commit messages, this will turn “Bug ####” into a link to the appropriate bug.

-xdoc

Generate Maven XDoc instead of HTML. This allows Maven and Maven 2 to integrate the reports when it generates the projects Maven site. Reports could be placed, for example, into src/site/statcvs.

-verbose

Output additional progress information.

-debug

Output lots of additional progress information.

-version

Output the version of StatCVS.

Setting Start and End Dates

StatCVS doesn't provide options to specify a start and end date for the report. But you can use some options of the cvs log command to achieve the same effect.

Setting a start date

cvs log -d "2002-01-01<" > logfile.log

This will result in a logfile starting at January 1st, 2002.

Setting an end date

If you want to specify an end date, then you also have to check out the module as of this date.

cvs checkout -D 2002-12-31 modulename
cd modulename
cvs log -d "<2002-12-31" > logfile.log

The example checks out a module and creates a log that ends December 31st, 2002.

Setting both start and end date

You can combine both approaches. This example generates a log for a report of 2002:

cvs checkout -D 2002-12-31 modulename
cd modulename
cvs log -d "2002-01-01<2002-12-31" > logfile.log

More information on the log -d option can be found in the CVS manual.

Ant Task

StatCVS comes with an Ant task for the Apache Ant build tool.

An example build file:

<?xml version="1.0"?>
<project name="Example" default="stats" basedir=".">
  <target name="stats">
    <taskdef name="statcvs"
             classname="net.sf.statcvs.ant.StatCvsTask"
             classpath="dist/statcvs.jar"/>
    <statcvs log="cvs.log"
             path="."
             title="StatCVS"
             outputDir="stats"
             notes="etc/report-notes.txt"
             viewcvs="http://statcvs.cvs.sourceforge.net/statcvs/statcvs"
             tags="v.*"/>
  </target>
</project>

The attributes log and path are required. The other attributes are optional, their names correspond to the command line options. The path to statcvs.jar has to be provided in the <taskdef/>'s classpath attribute.

Limitations

This section lists some limitations and inaccuracies of StatCVS and its reports.

Further Reading

StatCVS offers a view into CVS repository activity
IBM developerWorks has an article on StatCVS by Tom Copeland. Includes a section on generating reports for several repositories at once and a sidebar on the value (or lack thereof) of LOC as a measure for productivity.