We are in the process of moving to SVN.
我们正在迁移到SVN。
Unfortunately for us, we are audited periodically, where the auditors require information like:
Histories of changes to files
History of access to SVN
New files Added
Changes in files
对我们来说不幸的是,我们会定期审核,审核员需要以下信息:文件更改历史记录访问SVN的历史新文件添加了文件更改
Is there a tool which can produce these reports for us (or some of these)?
是否有可以为我们(或其中一些)生成这些报告的工具?
10 个解决方案
#1
StatSVN
is a light weight subversion report generator. http://www.statsvn.org/
StatSVN是一个轻量级的颠覆报告生成器。 http://www.statsvn.org/
-
first generate the verbose log file -
svn log
首先生成详细日志文件 - svn log
-
run
StatSVN
, it is a single jar file.运行StatSVN,它是一个jar文件。
StatSVN
provides a list of metrics:
StatSVN提供了一系列指标:
- which file is changed the most
- how many lines are added
- who is contributing more
哪个文件更改最多
添加了多少行
谁贡献更多
#2
Trac (http://trac.edgewall.com) can be used to view the SVN details. Trac has nice features like a changeset view that allows to see different changesets (and go back or forth through them). It also presents a nice UI , much better than ViewVC(www.viewvc.org)
Trac(http://trac.edgewall.com)可用于查看SVN详细信息。 Trac具有很好的功能,例如变更集视图,可以查看不同的变更集(并在它们之间来回传递)。它还提供了一个很好的用户界面,远远优于ViewVC(www.viewvc.org)
#3
svn log is the basic command to get the file related information you're looking for...
svn log是获取您正在寻找的文件相关信息的基本命令...
#4
You can have all of that information just through the SVN revision logs. You might want to consider a nice tool like Fisheye to do it for you though.
您可以通过SVN修订日志获得所有这些信息。你可能想要考虑像Fisheye这样的好工具为你做这件事。
#5
SVN provides much of what you ask for right from the command line:
SVN从命令行提供了许多您要求的内容:
- History of changes to a specific file/directory:
svn log /your/path
gives you source code diffs, authors, check-in dates etc. - New files added:
svnlook changed -r <rev> <path to repository>
gives you all files which were touched in the given revision. Loop over all relevant revisions, andgrep
for "A" which denotes added files. - Changes in files:
svn diff -r <first rev>:<last rev> <path>
gives you a diff of for the entire span of revisions - History of access to SVN: SVN obviously maintains a log of all check-ins (see
svn log
). As for reading access, I don't know of a builtin mechanism, however you can probably create your own with little effort, depending on the configuration. If you only allow http access, you can use the webserver's log files.
特定文件/目录的更改历史记录:svn log / your / path为您提供源代码差异,作者,签到日期等。
添加了新文件:svnlook已更改-r
文件中的更改:svn diff -r
访问SVN的历史记录:SVN显然会维护所有签入的日志(请参阅svn日志)。至于读取访问,我不知道内置机制,但是您可以轻松创建自己的机制,具体取决于配置。如果您只允许http访问,则可以使用Web服务器的日志文件。
It's not pretty, but SVN's output is highly structured so you can do your own formatting easily.
它并不漂亮,但SVN的输出结构很高,因此您可以轻松地进行自己的格式化。
#6
Here are some that I have used before to give a glance at change activity reporting and trends. The filtering isn't perfect, but you can get the idea:
以下是我之前使用的一些内容,用于了解变更活动报告和趋势。过滤并不完美,但你可以得到这个想法:
set REPO_URL=svn://localhost/...
set REVISION_START=1
set REVISION_END=HEAD
set COMMAND=svn log %REPO_URL% -v -g -r %REVISION_START%:%REVISION_END%
set REG_EXPRESSION="^...[ACDIMRX].\/"
Affected Configuration Items:
受影响的配置项:
%COMMAND% | find /c "/"
Changesets:
%COMMAND% | find /c "Changed paths"
List of unique files that have been affected over the given revision range (I had cygwin installed):
受给定修订范围影响的唯一文件列表(我安装了cygwin):
%COMMAND% | findstr /r %REG_EXPRESSION% | sort | uniq -u
#7
Take a look at codesaga. It makes a good job of visualizing source control commits. I can't vouch for the reporting part.
看看codesaga。它可以很好地可视化源代码控制提交。我无法保证报告部分。
#8
This program might help you out, not with audits, but updates
该计划可能会帮助您,而不是审计,而是更新
http://www.svnmonitor.com/default.shtml
- Monitor the source for certain events
- Receive notifications of any kind (balloon popups, tray icons, email, sounds, ...) when certain events occur
监视某些事件的来源
在发生特定事件时接收任何类型的通知(气球弹出窗口,托盘图标,电子邮件,声音......)
#9
To see actual accesses to SVN, you'd need to parse the Apache server logs (assuming you're serving SVN over Apache).
要查看对SVN的实际访问,您需要解析Apache服务器日志(假设您通过Apache提供SVN)。
#10
This question is also a bit old, but I've crafted a script that may be useful for simple reporting/auditing of Subversion and to keep track of the changes made to a SVN repository and I wanted to share it. It extracts information about SVN commits in a similar way to the command "svnlook" but it has a pair of advantages. First, it allows to iterate over all revisions of a repository to keep track of all the changes made. Second, the information is printed in a tab-separated tabular format (as in Unix commands like ps or df) that is both human readable and easy to parse or to import into a spreadsheet, which is great for reporting. It can also be called or embedded in a SVN post-commit hook.
这个问题也有点旧,但我制作了一个脚本,可能对Subversion的简单报告/审核有用,并跟踪对SVN存储库所做的更改,我想分享它。它以与命令“svnlook”类似的方式提取有关SVN提交的信息,但它具有一对优点。首先,它允许迭代存储库的所有修订版以跟踪所做的所有更改。其次,信息以制表符分隔的表格格式打印(如在ps或df等Unix命令中),这些格式既人性又易于解析或导入电子表格,非常适合报告。它也可以在SVN post-commit钩子中调用或嵌入。
It is a Perl script called svn-commit-info.pl and takes three arguments. The first is the repository path and it is mandatory. The second, optional, is the file pattern to search. And the third, also optional, is the revision number to query.
它是一个名为svn-commit-info.pl的Perl脚本,它有三个参数。第一个是存储库路径,它是必需的。第二个是可选的,是要搜索的文件模式。第三个也是可选的,是要查询的修订号。
If executed only with the repository path, it prints to STDOUT information about the files affected by all the commits made in the repository. For example, assuming the repository is stored in /svn/repos/test in the Subversion server:
如果仅使用存储库路径执行,则会向STDOUT打印有关受存储库中所有提交影响的文件的信息。例如,假设存储库存储在Subversion服务器中的/ svn / repos / test中:
$ perl svn-commit-info.pl /svn/repos/test
# Repository: /svn/repos/test
# Fields: Action, Revision, Date, Author, Bytes, Path
# Actions: A = New, D = Deleted, U = Updated
A 1 2017-01-31 17:21:19 Samsa <DIR> TestProject/
A 2 2017-01-31 17:21:33 Samsa 815 TestProject/.project
A 2 2017-01-31 17:21:33 Samsa <DIR> TestProject/.settings/
A 2 2017-01-31 17:21:33 Samsa 564 TestProject/.settings/.jsdtscope
A 2 2017-01-31 17:21:33 Samsa <DIR> TestProject/www/
A 3 2017-01-31 17:27:48 David 355 TestProject/www/test.html
A 3 2017-01-31 17:27:48 David <DIR> TestProject/www/css/
A 3 2017-01-31 17:27:48 David 9622 TestProject/www/css/logo.jpg
A 3 2017-01-31 17:27:48 David 1231 TestProject/www/css/reportstyle.css
A 3 2017-01-31 17:27:48 David 168345 TestProject/www/css/style.css
U 4 2017-02-01 10:48:34 Samsa 183260 TestProject/www/css/style.css
D 5 2017-02-01 12:51:26 David 355 TestProject/www/test.html
The tab-separated fields are: the operation performed, the revision number, the date and time, the author of the revision, the file size in bytes (unless the file is a directory marked by the string "<DIR>") and the path of the affected file in the repository. The first three lines contain human oriented comments about the output.
选项卡分隔的字段是:执行的操作,修订号,日期和时间,修订的作者,文件大小(以字节为单位)(除非文件是由字符串“
The output of the former command can take a long time to complete if the repository is big, with many files or revisions. If you want to keep track of the changes made to a particular file (or a set of files), it is better to specify the file pattern (that, in fact, is a Perl regexp). For example, to get information about the changes made to the file style.css:
如果存储库很大,包含许多文件或修订版,则前一个命令的输出可能需要很长时间才能完成。如果要跟踪对特定文件(或一组文件)所做的更改,最好指定文件模式(事实上,它是Perl regexp)。例如,要获取有关对文件style.css所做更改的信息:
$ perl svn-commit-info.pl /svn/repos/test style.css
If you are interested in a particular revision, you can specify the third parameter. For example to print all the changes of the third revision, taking into account that '.' matches any character in a Perl regular expression:
如果您对特定修订感兴趣,可以指定第三个参数。例如,打印第三个修订版的所有更改,同时考虑到'。'匹配Perl正则表达式中的任何字符:
$ perl svn-commit-info.pl /svn/repos/test . 3
And of course you could harness the power of Unix filters and pipelining to do more complex queries, for example to find all the modifications made by user David:
当然,您可以利用Unix过滤器和流水线操作的强大功能来执行更复杂的查询,例如查找用户David所做的所有修改:
$ svn-commit-info.pl /svn/repos/test | grep David
To find all the files created with size >= 1Mb:
要查找使用size> = 1Mb创建的所有文件:
$ svn-commit-info.pl /svn/repos/test | awk '$1 = "A" && $6 ~ /[0-9]/ && $6 >= 1024*1024'
The script uses the standard Subversion command "svnlook" but otherwise it is self contained. There are two helper functions to build the command and get the output of "svnlook" and then mades successive calls to the command to compose the output. It requires Subversion >= 1.7 and it has been tested on Perl 5.10.
该脚本使用标准的Subversion命令“svnlook”,但是它是自包含的。有两个辅助函数来构建命令并获取“svnlook”的输出,然后连续调用该命令来组成输出。它需要Subversion> = 1.7并且已经在Perl 5.10上进行了测试。
#!/usr/bin/env perl
use strict;
my $SVNLOOKCMD = "/usr/bin/svnlook";
my @FIELDS = qw(Action Revision Date Author Bytes Path);
# Builds and returns the "svnlook" command
sub svnlook_cmd {
my($repository, $action, $revision, @varargs) = @_;
my $cmd = $SVNLOOKCMD;
$cmd.= " -r $revision" if $revision;
$cmd.= " $action '$repository'";
$cmd.= join "", map { " '$_'" } @varargs;
$cmd.= '|';
return $cmd;
}
# Executes the "svnlook" command and returns the output lines
sub svnlook_output {
my($repository, $action, $revision, @varargs) = @_;
open(my $svnlookfh, svnlook_cmd $repository, $action, $revision, @varargs);
my @output = <$svnlookfh>;
close $svnlookfh;
chomp @output;
return wantarray ? @output : $output[0];
}
my($repository, $file, $revision) = @ARGV;
unless($repository) {
# 'repository' is the only mandatory argument
print STDERR "$0 <repository> [<file>] [<revision>]\n";
print STDERR "\t<repository> = path of Subversion repository\n";
print STDERR "\t<file> = file pattern to search for (regular expression)\n";
print STDERR "\t<revision> = commit revision number\n";
exit 1;
}
$file = "." unless $file;
my $first = $revision ? $revision : 1;
my $last = $revision ? $revision : svnlook_output $repository, "youngest";
print "# Repository: $repository\n";
print "# Fields: ", join(", ", @FIELDS), "\n";
print "# Actions: A = New, D = Deleted, U = Updated\n";
for(my $rev = $first; $rev <= $last; $rev++) {
my $author = "";
my $date = "";
foreach my $line (svnlook_output $repository, "changed", $rev) {
if($line =~ /$file/i) {
unless($date) {
$date = svnlook_output $repository, "date", $rev;
$date =~ s|^(\S+) (\S+).*$|\1 \2|;
}
$author = uc svnlook_output $repository, "author", $rev unless $author;
my($action, $path) = split /\s+/, $line, 2;
my $size;
if($path =~ m|/$|) {
$size = sprintf("%12s", "<DIR>");
} else {
$size = svnlook_output $repository, "filesize", $rev, $path;
$size = sprintf("%12d", $size);
}
print join("\t", $action, $rev, $date, $author, $size, $path), "\n";
}
}
}
exit 0;
Hope this helps and sorry for the long post.
希望这对长篇文章有所帮助和抱歉。
#1
StatSVN
is a light weight subversion report generator. http://www.statsvn.org/
StatSVN是一个轻量级的颠覆报告生成器。 http://www.statsvn.org/
-
first generate the verbose log file -
svn log
首先生成详细日志文件 - svn log
-
run
StatSVN
, it is a single jar file.运行StatSVN,它是一个jar文件。
StatSVN
provides a list of metrics:
StatSVN提供了一系列指标:
- which file is changed the most
- how many lines are added
- who is contributing more
哪个文件更改最多
添加了多少行
谁贡献更多
#2
Trac (http://trac.edgewall.com) can be used to view the SVN details. Trac has nice features like a changeset view that allows to see different changesets (and go back or forth through them). It also presents a nice UI , much better than ViewVC(www.viewvc.org)
Trac(http://trac.edgewall.com)可用于查看SVN详细信息。 Trac具有很好的功能,例如变更集视图,可以查看不同的变更集(并在它们之间来回传递)。它还提供了一个很好的用户界面,远远优于ViewVC(www.viewvc.org)
#3
svn log is the basic command to get the file related information you're looking for...
svn log是获取您正在寻找的文件相关信息的基本命令...
#4
You can have all of that information just through the SVN revision logs. You might want to consider a nice tool like Fisheye to do it for you though.
您可以通过SVN修订日志获得所有这些信息。你可能想要考虑像Fisheye这样的好工具为你做这件事。
#5
SVN provides much of what you ask for right from the command line:
SVN从命令行提供了许多您要求的内容:
- History of changes to a specific file/directory:
svn log /your/path
gives you source code diffs, authors, check-in dates etc. - New files added:
svnlook changed -r <rev> <path to repository>
gives you all files which were touched in the given revision. Loop over all relevant revisions, andgrep
for "A" which denotes added files. - Changes in files:
svn diff -r <first rev>:<last rev> <path>
gives you a diff of for the entire span of revisions - History of access to SVN: SVN obviously maintains a log of all check-ins (see
svn log
). As for reading access, I don't know of a builtin mechanism, however you can probably create your own with little effort, depending on the configuration. If you only allow http access, you can use the webserver's log files.
特定文件/目录的更改历史记录:svn log / your / path为您提供源代码差异,作者,签到日期等。
添加了新文件:svnlook已更改-r
文件中的更改:svn diff -r
访问SVN的历史记录:SVN显然会维护所有签入的日志(请参阅svn日志)。至于读取访问,我不知道内置机制,但是您可以轻松创建自己的机制,具体取决于配置。如果您只允许http访问,则可以使用Web服务器的日志文件。
It's not pretty, but SVN's output is highly structured so you can do your own formatting easily.
它并不漂亮,但SVN的输出结构很高,因此您可以轻松地进行自己的格式化。
#6
Here are some that I have used before to give a glance at change activity reporting and trends. The filtering isn't perfect, but you can get the idea:
以下是我之前使用的一些内容,用于了解变更活动报告和趋势。过滤并不完美,但你可以得到这个想法:
set REPO_URL=svn://localhost/...
set REVISION_START=1
set REVISION_END=HEAD
set COMMAND=svn log %REPO_URL% -v -g -r %REVISION_START%:%REVISION_END%
set REG_EXPRESSION="^...[ACDIMRX].\/"
Affected Configuration Items:
受影响的配置项:
%COMMAND% | find /c "/"
Changesets:
%COMMAND% | find /c "Changed paths"
List of unique files that have been affected over the given revision range (I had cygwin installed):
受给定修订范围影响的唯一文件列表(我安装了cygwin):
%COMMAND% | findstr /r %REG_EXPRESSION% | sort | uniq -u
#7
Take a look at codesaga. It makes a good job of visualizing source control commits. I can't vouch for the reporting part.
看看codesaga。它可以很好地可视化源代码控制提交。我无法保证报告部分。
#8
This program might help you out, not with audits, but updates
该计划可能会帮助您,而不是审计,而是更新
http://www.svnmonitor.com/default.shtml
- Monitor the source for certain events
- Receive notifications of any kind (balloon popups, tray icons, email, sounds, ...) when certain events occur
监视某些事件的来源
在发生特定事件时接收任何类型的通知(气球弹出窗口,托盘图标,电子邮件,声音......)
#9
To see actual accesses to SVN, you'd need to parse the Apache server logs (assuming you're serving SVN over Apache).
要查看对SVN的实际访问,您需要解析Apache服务器日志(假设您通过Apache提供SVN)。
#10
This question is also a bit old, but I've crafted a script that may be useful for simple reporting/auditing of Subversion and to keep track of the changes made to a SVN repository and I wanted to share it. It extracts information about SVN commits in a similar way to the command "svnlook" but it has a pair of advantages. First, it allows to iterate over all revisions of a repository to keep track of all the changes made. Second, the information is printed in a tab-separated tabular format (as in Unix commands like ps or df) that is both human readable and easy to parse or to import into a spreadsheet, which is great for reporting. It can also be called or embedded in a SVN post-commit hook.
这个问题也有点旧,但我制作了一个脚本,可能对Subversion的简单报告/审核有用,并跟踪对SVN存储库所做的更改,我想分享它。它以与命令“svnlook”类似的方式提取有关SVN提交的信息,但它具有一对优点。首先,它允许迭代存储库的所有修订版以跟踪所做的所有更改。其次,信息以制表符分隔的表格格式打印(如在ps或df等Unix命令中),这些格式既人性又易于解析或导入电子表格,非常适合报告。它也可以在SVN post-commit钩子中调用或嵌入。
It is a Perl script called svn-commit-info.pl and takes three arguments. The first is the repository path and it is mandatory. The second, optional, is the file pattern to search. And the third, also optional, is the revision number to query.
它是一个名为svn-commit-info.pl的Perl脚本,它有三个参数。第一个是存储库路径,它是必需的。第二个是可选的,是要搜索的文件模式。第三个也是可选的,是要查询的修订号。
If executed only with the repository path, it prints to STDOUT information about the files affected by all the commits made in the repository. For example, assuming the repository is stored in /svn/repos/test in the Subversion server:
如果仅使用存储库路径执行,则会向STDOUT打印有关受存储库中所有提交影响的文件的信息。例如,假设存储库存储在Subversion服务器中的/ svn / repos / test中:
$ perl svn-commit-info.pl /svn/repos/test
# Repository: /svn/repos/test
# Fields: Action, Revision, Date, Author, Bytes, Path
# Actions: A = New, D = Deleted, U = Updated
A 1 2017-01-31 17:21:19 Samsa <DIR> TestProject/
A 2 2017-01-31 17:21:33 Samsa 815 TestProject/.project
A 2 2017-01-31 17:21:33 Samsa <DIR> TestProject/.settings/
A 2 2017-01-31 17:21:33 Samsa 564 TestProject/.settings/.jsdtscope
A 2 2017-01-31 17:21:33 Samsa <DIR> TestProject/www/
A 3 2017-01-31 17:27:48 David 355 TestProject/www/test.html
A 3 2017-01-31 17:27:48 David <DIR> TestProject/www/css/
A 3 2017-01-31 17:27:48 David 9622 TestProject/www/css/logo.jpg
A 3 2017-01-31 17:27:48 David 1231 TestProject/www/css/reportstyle.css
A 3 2017-01-31 17:27:48 David 168345 TestProject/www/css/style.css
U 4 2017-02-01 10:48:34 Samsa 183260 TestProject/www/css/style.css
D 5 2017-02-01 12:51:26 David 355 TestProject/www/test.html
The tab-separated fields are: the operation performed, the revision number, the date and time, the author of the revision, the file size in bytes (unless the file is a directory marked by the string "<DIR>") and the path of the affected file in the repository. The first three lines contain human oriented comments about the output.
选项卡分隔的字段是:执行的操作,修订号,日期和时间,修订的作者,文件大小(以字节为单位)(除非文件是由字符串“
The output of the former command can take a long time to complete if the repository is big, with many files or revisions. If you want to keep track of the changes made to a particular file (or a set of files), it is better to specify the file pattern (that, in fact, is a Perl regexp). For example, to get information about the changes made to the file style.css:
如果存储库很大,包含许多文件或修订版,则前一个命令的输出可能需要很长时间才能完成。如果要跟踪对特定文件(或一组文件)所做的更改,最好指定文件模式(事实上,它是Perl regexp)。例如,要获取有关对文件style.css所做更改的信息:
$ perl svn-commit-info.pl /svn/repos/test style.css
If you are interested in a particular revision, you can specify the third parameter. For example to print all the changes of the third revision, taking into account that '.' matches any character in a Perl regular expression:
如果您对特定修订感兴趣,可以指定第三个参数。例如,打印第三个修订版的所有更改,同时考虑到'。'匹配Perl正则表达式中的任何字符:
$ perl svn-commit-info.pl /svn/repos/test . 3
And of course you could harness the power of Unix filters and pipelining to do more complex queries, for example to find all the modifications made by user David:
当然,您可以利用Unix过滤器和流水线操作的强大功能来执行更复杂的查询,例如查找用户David所做的所有修改:
$ svn-commit-info.pl /svn/repos/test | grep David
To find all the files created with size >= 1Mb:
要查找使用size> = 1Mb创建的所有文件:
$ svn-commit-info.pl /svn/repos/test | awk '$1 = "A" && $6 ~ /[0-9]/ && $6 >= 1024*1024'
The script uses the standard Subversion command "svnlook" but otherwise it is self contained. There are two helper functions to build the command and get the output of "svnlook" and then mades successive calls to the command to compose the output. It requires Subversion >= 1.7 and it has been tested on Perl 5.10.
该脚本使用标准的Subversion命令“svnlook”,但是它是自包含的。有两个辅助函数来构建命令并获取“svnlook”的输出,然后连续调用该命令来组成输出。它需要Subversion> = 1.7并且已经在Perl 5.10上进行了测试。
#!/usr/bin/env perl
use strict;
my $SVNLOOKCMD = "/usr/bin/svnlook";
my @FIELDS = qw(Action Revision Date Author Bytes Path);
# Builds and returns the "svnlook" command
sub svnlook_cmd {
my($repository, $action, $revision, @varargs) = @_;
my $cmd = $SVNLOOKCMD;
$cmd.= " -r $revision" if $revision;
$cmd.= " $action '$repository'";
$cmd.= join "", map { " '$_'" } @varargs;
$cmd.= '|';
return $cmd;
}
# Executes the "svnlook" command and returns the output lines
sub svnlook_output {
my($repository, $action, $revision, @varargs) = @_;
open(my $svnlookfh, svnlook_cmd $repository, $action, $revision, @varargs);
my @output = <$svnlookfh>;
close $svnlookfh;
chomp @output;
return wantarray ? @output : $output[0];
}
my($repository, $file, $revision) = @ARGV;
unless($repository) {
# 'repository' is the only mandatory argument
print STDERR "$0 <repository> [<file>] [<revision>]\n";
print STDERR "\t<repository> = path of Subversion repository\n";
print STDERR "\t<file> = file pattern to search for (regular expression)\n";
print STDERR "\t<revision> = commit revision number\n";
exit 1;
}
$file = "." unless $file;
my $first = $revision ? $revision : 1;
my $last = $revision ? $revision : svnlook_output $repository, "youngest";
print "# Repository: $repository\n";
print "# Fields: ", join(", ", @FIELDS), "\n";
print "# Actions: A = New, D = Deleted, U = Updated\n";
for(my $rev = $first; $rev <= $last; $rev++) {
my $author = "";
my $date = "";
foreach my $line (svnlook_output $repository, "changed", $rev) {
if($line =~ /$file/i) {
unless($date) {
$date = svnlook_output $repository, "date", $rev;
$date =~ s|^(\S+) (\S+).*$|\1 \2|;
}
$author = uc svnlook_output $repository, "author", $rev unless $author;
my($action, $path) = split /\s+/, $line, 2;
my $size;
if($path =~ m|/$|) {
$size = sprintf("%12s", "<DIR>");
} else {
$size = svnlook_output $repository, "filesize", $rev, $path;
$size = sprintf("%12d", $size);
}
print join("\t", $action, $rev, $date, $author, $size, $path), "\n";
}
}
}
exit 0;
Hope this helps and sorry for the long post.
希望这对长篇文章有所帮助和抱歉。