The amount of the SVN Code statistics tool

Source: Internet
Author: User
Tags svn client code chart

STATSVN Introduction

STATSVN is the Java write Open source statistics program from Statcvs to porting. From the can subversion version number to obtain the information base, the project developed a descriptive description, and then generate a variety of tables and charts. Example: Time line. The number of lines of code for each developer, the level of developer activity, recent submissions by developers, number of documents, average file size, and maximum files. Which file is the maximum number of changes, folder size, repository tree with the number of files and the number of lines of code.

STATSVN the current version number can generate a set of static HTML documents that contain tables and graphs.


STATSVN Download

STARTSVN Official website address is: http://www.statsvn.org/index.html

The download page for STARTSVN is: http://www.statsvn.org/downloads.html

The latest version number on the official website is now: statsvn-0.7.0


STATSVN use

Notice of Use

The implementation of STATSVN requires Java's execution environment support. So you need to install Java Runtime environment. The JRE can be downloaded from the Sun's site.

STATSVN needs to use SVN's client in use, so make sure that the SVN client commands are available on the machine

Checkout Working Copy

First, checkout a required statistic path from the SVN repository (assuming that the statistics are in the working folder. First please update. Make sure that the version number in the workspace is the latest version number. Ensure the accuracy of the statistical results), such as I checkout the project under one of my paths to the D:\MyProjects path on my computer.

Generate SVN log file

First go to working folder via command line: D:\MyProjects, then use svn log-v--xml > Logfile.log command, logfile.log as log file name, can be defined according to the need.

This generates a file named Logfile.log under the folder 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, and you can enter SVN help on the cmd command line to test if the component is installed. It is not possible to use the SVN log command if it is not installed.

Assuming that you can manipulate 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 folder

Enter the D:\statsvn-0.7.0 folder from the command line

Call command Java-jar statsvn.jar D:\MyProjects\logfile.log D:\MyProjects, command execution completed the statistical work.

The format of the command is Java-jar Statsvn.jar [options] <logfile> <checked-out-module>

Parameters <logfile> The SVN log file generated in the previous step. <checked-out-module> Copy the folder for checkout work, note that the correct full path is listed for all two parameters, otherwise it will prompt for errors such as logfile.log not found, etc.

    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 method of use for example are as follows:

  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: )
  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


1. Pilot out SVN log

   svn log-v--xml-rstartrevision:endrevision > Svn.log local_project


2. Analysis with STATSVN tools
Java-jar Statsvn.jar Svn.log Local_project
After execution, the corresponding analysis files will be generated under $PWD (under Unix) or%cd% (under Windows), and there will be a code count in the index.html file.



#!/bin/bashsvn_dir= '/home/homer/work/code_svn/weiguan ' statsvn_dir= '/home/homer/work/tool-server/statsvn-0.7.0/ Statsvn.jar ' log_dir=svnstatlog_file= ' $log _dir/svnstat.log "log_day=" $log _dir/2014-01-01_00:00:00 "version_start= 4150version_end=4159function statsvn () {    cd $svn _dir    svn up    if [!-D $log _dir];then        mkdir $log _dir    fi    date=$ (date "+%y-%m-%d_%h:%m:%s")    echo "$date"        lines= ' Find-name *.java | xargs wc-l | sort-n ' 
   
    echo "Total code lines: $lines"    version_end= ' svn log-l1 | sed-n 2p | awk ' {print $} ' | cut-d "R"-f2 '    Echo "Version_start: $version _start; Version_end: $version _end "    svn log-v--xml-r$version_start: $version _end > $log _file    log_day=" $log _dir/ $date "    java-jar $statsvn _dir $log _file.-output-dir $log _day >/dev/null 2>&1    google-chrome $log _ Day/index.html &}STATSVN
   


Recommended References:

STATSVN count the amount of code in SVN

How to count the amount of code on SVN-using the STATSVN tool

Statistical analysis of the number of code submitted by SVN users per day

An SVN-based code submission volume Statistics Tool

Statsvn


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

The amount of the SVN Code statistics tool

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.