svn 可以提供哪些报告?

发布于 2024-07-11 13:34:55 字数 153 浏览 9 评论 0原文

我们正在迁移到 SVN。

对我们来说不幸的是,我们会定期接受审核,审核员需要以下信息:
文件更改历史
访问 SVN 的历史
添加了新文件
文件更改

是否有工具可以为我们生成这些报告(或其中一些报告)?

We are in the process of moving to 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

Is there a tool which can produce these reports for us (or some of these)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

彩扇题诗 2024-07-18 13:34:55

StatSVN 是一个轻量级的颠覆报告生成器。
http://www.statsvn.org/

  1. 首先生成详细日志文件 - svn 日志

  2. 运行 < code>StatSVN ,它是一个 jar 文件。

StatSVN 提供了一个指标列表:

  • 哪个文件更改最多、
  • 添加了多少行、
  • 谁贡献更多

StatSVN is a light weight subversion report generator.
http://www.statsvn.org/

  1. first generate the verbose log file - svn log

  2. run StatSVN , it is a single jar file.

StatSVN provides a list of metrics:

  • which file is changed the most
  • how many lines are added
  • who is contributing more
信愁 2024-07-18 13:34:55

Trac (http://trac.edgewall.com) 可用于查看 SVN 详细信息。 Trac 具有很好的功能,例如变更集视图,允许查看不同的变更集(并来回浏览它们)。 它还提供了一个漂亮的 UI,比 ViewVC(www.viewvc.org) 好得多

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)

满地尘埃落定 2024-07-18 13:34:55

svn log 是获取文件相关信息的基本命令正在寻找...

svn log is the basic command to get the file related information you're looking for...

超可爱的懒熊 2024-07-18 13:34:55

您只需通过 SVN 修订日志即可获得所有这些信息。 您可能需要考虑一个不错的工具,例如 Fisheye 来为您完成此操作。

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.

燕归巢 2024-07-18 13:34:55

SVN 直接从命令行提供您所需的大部分内容:

  • 特定文件/目录的更改历史记录:svn log /your/path 为您提供源代码差异、作者、签入日期等 添加了新文件
  • svnlook 已更改 -r; <存储库路径> 为您提供给定修订版中涉及的所有文件。 循环遍历所有相关修订,并使用 grep 查找“A”,表示添加的文件。
  • 文件更改:svn diff -r:; 为您提供整个修订范围的差异
  • SVN 的访问历史:SVN 显然维护着所有签入的日志(请参阅 svn log)。 至于读取访问,我不知道内置机制,但是您可能可以轻松创建自己的机制,具体取决于配置。 如果您只允许 http 访问,则可以使用网络服务器的日志文件。

它并不漂亮,但 SVN 的输出是高度结构化的,因此您可以轻松地进行自己的格式化。

SVN provides much of what you ask for right from the command line:

  • 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, and grep 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.

It's not pretty, but SVN's output is highly structured so you can do your own formatting easily.

北音执念 2024-07-18 13:34:55

以下是我之前用来浏览变更活动报告和趋势的一些内容。 过滤并不完美,但您可以得到这个想法:

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].\/"

受影响的配置项:

%COMMAND% | find /c "/"

变更集:

%COMMAND% | find /c "Changed paths"

在给定修订范围内受到影响的唯一文件列表(我安装了 cygwin):

%COMMAND% | findstr /r %REG_EXPRESSION% | sort | uniq -u

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

%COMMAND% | findstr /r %REG_EXPRESSION% | sort | uniq -u
霞映澄塘 2024-07-18 13:34:55

看看 codesaga。 它可以很好地可视化源代码控制提交。 我不能保证报告部分。

Take a look at codesaga. It makes a good job of visualizing source control commits. I can't vouch for the reporting part.

水晶透心 2024-07-18 13:34:55

该程序可能会帮助您,但不是审核,而是更新

http://www.svnmonitor.com/default .shtml

  • 监视某些事件的来源
  • 当某些事件发生时接收任何类型的通知(气球弹出窗口、托盘图标、电子邮件、声音...)

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
鯉魚旗 2024-07-18 13:34:55

要查看对 SVN 的实际访问,您需要解析 Apache 服务器日志(假设您通过 Apache 提供 SVN)。

To see actual accesses to SVN, you'd need to parse the Apache server logs (assuming you're serving SVN over Apache).

玩套路吗 2024-07-18 13:34:55

这个问题也有点老了,但我制作了一个脚本,可能对 Subversion 的简单报告/审核有用,并跟踪对 SVN 存储库所做的更改,我想分享它。 它提取
有关 SVN 提交的信息与命令“svnlook”类似,但它有两个优点。 首先,它允许迭代存储库的所有修订以跟踪所做的所有更改。 其次,
信息以制表符分隔的表格格式(如 ps 或 df 等 Unix 命令)打印,既便于人类阅读,又易于解析或导入到电子表格中,这非常适合报告。 它也可以被称为或
嵌入到 SVN post-commit hook 中。

它是一个名为 svn-commit-info.pl 的 Perl 脚本,带有三个参数。 第一个是存储库路径
这是强制性的。 第二个是可选的,是要搜索的文件模式。 第三个也是可选的,是
要查询的修订号。

如果仅使用存储库路径执行,它将打印到 STDOUT 有关受所有影响的文件的信息
在存储库中进行的提交。 例如,假设存储库存储在 /svn/repos/test 中
Subversion 服务器:

$ 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            

制表符分隔的字段为:执行的操作、修订版本号、日期和时间、修订版本的作者、
文件大小(以字节为单位)(除非文件是由字符串“

”标记的目录)以及受影响文件的路径
存储库。 前三行包含有关输出的以人为本的注释。

如果存储库很大,有很多文件或,前一个命令的输出可能需要很长时间才能完成
修订。 如果您想跟踪对特定文件(或一组文件)所做的更改,最好
指定文件模式(实际上,这是一个 Perl 正则表达式)。 例如,获取有关更改的信息
对文件 style.css 进行修改:

$ perl svn-commit-info.pl /svn/repos/test style.css

如果您对特定修订版感兴趣,则可以指定第三个参数。 例如打印所有更改
第三次修订,考虑到“.” 匹配 Perl 正则表达式中的任何字符:

$ perl svn-commit-info.pl /svn/repos/test . 3

当然,您可以利用 Unix 过滤器和管道的强大功能来执行更复杂的查询,例如
查找用户 David 所做的所有修改:

$ svn-commit-info.pl /svn/repos/test | grep David

查找所有创建的大小 >= 1Mb 的文件:

$ svn-commit-info.pl /svn/repos/test | awk '$1 = "A" && $6 ~ /[0-9]/ && $6 >= 1024*1024'

该脚本使用标准 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;

希望这对您有所帮助,并对这么长的帖子表示歉意。

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.

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.

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:

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

$ svn-commit-info.pl /svn/repos/test | grep David

To find all the files created with 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.

#!/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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文