安装svn工具
1.安装TortoiseSVN,在安装时需要安装svn命令行工具。
2.下载statsvn ,这是一个用java写的工具,也是本文的主角,它就是一个jar包。下载后解压放在任意目录即可。
statsvn命令行配置列表
-version 查看当前版本
-output-dir <dir> 报告输出目录
-include <pattern> 统计包含的文件 e.g. **/*.c;**/*.h
-exclude <pattern> 统计不包含的文件或者文件夹 e.g. tests/**;docs/**
-tags <regexp> show matching tags in lines of code chart, e.g. version-.*
-title <title> Project title to be 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 to pass to svn
-password <svnpassword> password to 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/')
实例说明
上述是准备工作。操作的步骤如下:
- 使用svn的命令行导出配置库的日志文件(统计软件会根据这个日志进行代码统计),命令如下:
svn log -v --xml -r {2016-12-19}:{2016-10-09} > svn.log
上述命令需要在配置库目录执行 ,svn.log就是生成的日志文件名称,上述命令导出了一个时间段的日志
svn log -v --xml > svn.log
上述命令导出了所有时间端的文件
- 使用statsvn命令行根据上述导出的日志进行统计,首先进入statsvn的文件夹目录。之后执行命令如下:
java -jar statsvn.jar <svnlogpath>\svn.log <svnrootpath> -charset gbk -output-dir <reportoutpath>
上述是一个模板。具体的内容如下:
java -jar statsvn.jar D:\screwspace\webfront\snap-web\svn.log D:\screwspace\webfront\snap-web -charset gbk -output-dir D:\soft\statsvn\snap-web
网友评论