Use STATSVN to count the amount of code in SVN

Source: Internet
Author: User
Tags code chart

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
    1. <logfile> path to the SVN logfile of the module
    2. <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
  1. Some options:
  2. -version Print the version information and exit
  3. -output-dir <dir> directory where HTML suite would be saved
  4. -include <pattern> include only files matching pattern, e.g. **/*.c;**/*.h
  5. -exclude <pattern> exclude matching files, e.g. tests/**;d ocs/**
  6. -tags <regexp> Show matching tags in lines of code chart, e.g. version-.*
  7. -title <title> Project title to being used in reports
  8. -VIEWVC <url> integrate with VIEWVC installation at <url>
  9. -trac <url> integrate with Trac at <url>
  10. -bugzilla <url> integrate with Bugzilla installation at <url>
  11. -username <svnusername> Username-Pass to SVN
  12. -password <svnpassword> Password-pass to SVN
  13. -verbose Print Extra Progress information
  14. -xdoc Optional switch output to Xdoc
  15. -xml Optional switch output to XML
  16. -threads <int> How many threads for SVN diff (default:25)
  17. -concurrency-threshold <millisec> Switch to concurrent SVN diff if 1st Call>threshol
  18. -dump dump the Repository content on console
  19. -charset <charset> Specify the charset to use for Html/xdoc
  20. -tags-dir <directory> Optional, specifies the director for tags (default '/tags/')
  21. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.