STATSVN Introduction
STATSVN is a Java-written open source code statistics program that is ported from Statcvs to get information from the Subversion repository and then generate various tables and graphs that describe the development of the project. For example: The line of code, the number of lines of code for each developer, the developer's level of activity, the number of files that the developer has recently submitted, the file size, average file sizes, maximum files, which files are the most frequently modified, the size of the directory, the repository tree with the number of files and the number of lines of code. The current version of STATSVN can generate a set of static HTML documents that include tables and graphs.
STATSVN Download
STARTSVN Official website address is: http://www.statsvn.org/index.html
STARTSVN download page is: http://www.statsvn.org/downloads.html can also download the attachment of this article
Now the latest version of the official web is: statsvn-0.7.0
STATSVN use
Notice of Use
STATSVN operation requires Java Runtime Environment support, so we need to install Java Runtime Environment (Java Runtime Environment). The JRE can be downloaded from the Sun's website.
STATSVN needs to use SVN's client in use, so you need to make sure that you have access to SVN's client commands on your machine
Checkout Working Copy
First, from the SVN repository checkout a need to count the path (if in the working directory, the first update, to ensure that the version in the workspace is the latest version, to ensure the accuracy of statistical results), such as I put a project under my path checkout on my Computer d:\ The myprojects path.
Generate SVN log file
Start with the command line into the working directory: D:\MyProjects, and then use the SVN log-v--xml > Logfile.log command, where Logfile.log is the name of the log file and can be defined as needed. This generates a file called Logfile.log in the directory of the working copy.
Note: To use the SVN command at the command line, you must choose to install the commend component when installing TORTOISESVN, you can enter SVN help on the cmd command line to test if the component is installed, if it is not installed, you cannot use the SVN log command. If you can operate SVN server, you can generate SVN log directly on the server and download it locally.
call STATSVN for statistics
First we extract the Statsvn-0.7.0.zip package downloaded from the official website into the D:\statsvn-0.7.0 directory
Enter the D:\statsvn-0.7.0 directory from the command line
Call command Java-jar Statsvn.jar D:\MyProjects\logfile.log D:\MyProjects, the command to run successfully completed the statistical work.
The format of the command is Java-jar Statsvn.jar [options] <logfile> <checked-out-module>
Parameters <logfile> for the SVN log file generated in the previous step,<checked-out-module> for the checkout working Copy directory, note that all two parameters should list the correct full path, Otherwise, you will be prompted for errors such as Logfile.log.
Java code
- <logfile> path to the SVN logfile of the module
- <directory> path to the directory of the checked out module
[Options] is an optional parameter, and the format and usage of this parameter are as follows:
Java code
- Some options:
- -version Print the version information and exit
- -output-dir <dir> directory where HTML suite would be saved
- -include <pattern> include only files matching pattern, e.g. **/*.c;**/*.h
- -exclude <pattern> exclude matching files, e.g. tests/**;d ocs/**
- -tags <regexp> Show matching tags in lines of code chart, e.g. version-.*
- -title <title> Project title to being used in reports
- -VIEWVC <url> integrate with VIEWVC installation at <url>
- -trac <url> integrate with Trac at <url>
- -bugzilla <url> integrate with Bugzilla installation at <url>
- -username <svnusername> Username-Pass to SVN
- -password <svnpassword> Password-pass to SVN
- -verbose Print Extra Progress information
- -xdoc Optional switch output to Xdoc
- -xml Optional switch output to XML
- -threads <int> How many threads for SVN diff (default:25)
- -concurrency-threshold <millisec> Switch to concurrent SVN diff if 1st Call>threshol
- -dump dump the Repository content on console
- -charset <charset> Specify the charset to use for Html/xdoc
- -tags-dir <directory> Optional, specifies the director for tags (default '/tags/')
- Full Options list:http://www.statsvn.org
Ext.: http://chenzhou123520.iteye.com/blog/1436653
View Statistical results
Once the above command runs successfully, you can see a set of static HTML documents in the D:\MyProjects directory that includes tables and graphs. The index.html can be opened in a browser to view statistical results.
Example Picture:
STATSVN Advantages and Disadvantages analysis
Advantages
STATSVN will present the state of the SVN library in the form of pictures and charts, can be divided into different categories to expand, powerful.
Disadvantages
STATSVN counts all lines of code, including comments and blank lines, but the general metric requirement is a valid line of code that you need to be aware of during analysis.
STATSVN does not consider the number of lines of code that are modified, only the number of lines of code that are new (+) and deleted (-) compared to the previous version.
Use STATSVN to count the amount of code in SVN