如何在单个 xml 文件中为分支中的所有非二进制文件获取递归 svn 责任报告?

发布于 2024-07-10 19:33:24 字数 391 浏览 4 评论 0原文

如何获得分支中所有非二进制文件的完全递归 svn 责任报告,其中输出位于 xml 格式的单个文件中,并包括修订、日期、作者、文件名和文件名。 路径,以及文件本身的行文本? 整个输出需要位于单个文件中。 它将作为构建的一部分通过 CCNet 实例执行。

可用的工具包括最新稳定版本的 nant 和 nantcontrib、msbuild 以及最新的命令行 svn。

以下是我遇到的一些问题: 命令行 svnblame 命令不支持目录递归。 Blame 的 --xml 选项不包括每行的实际文本,尽管它确实包含其他所有内容。 默认情况下,nantcontrib 传递 --quiet 参数(与任务引用相反),这在blame 命令上不受支持。 Nantcontrib svn 任务可能不接受 --xml 参数。

How can I get a fully recursive svn blame report for all non-binary files in a branch, where the output is in a single file in xml format and includes revision, date, author, filename & path, and the text of the line of the file itself? The entire output needs to be in a single file. It will be executed as part of the build via a CCNet instance.

Available tools are the latest stable release of nant and nantcontrib, msbuild, and latest command line svn.

Here's some of the issues I have run into: Command line svn blame command does not support directory recursion. Blame's --xml option does not include the actual text of each line, though it does have everything else. By default nantcontrib is passing the --quiet parameter (contrary to the task reference), which is not supported on the blame command. Nantcontrib svn task may not accept the --xml parameter.

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

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

发布评论

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

评论(2

孤独难免 2024-07-17 19:33:24

简单的答案是没有任何简单的方法可以做到这一点。 最好、最正确的方法是编写自己的 svn 客户端(或扩展现有客户端),以便它具有您需要的功能。 绝非微不足道。

还有一种错误的做法,也涉及到编写代码。 不要这样做

find . -type f | grep -v .svn | xargs svn blame > line_data
find . -type f | grep -v .svn | xargs svn --xml blame > xml_data

您可以将两个 svn 命令一起编写脚本以避免运行 find 两次,但这仍然会非常慢。 雪上加霜的是,您必须自己解析这两个文件,以将实际的源代码行添加到 xml 数据中。

可悲的是,我认为这就是标准 svn 客户端对您想要的支持的程度,并且我找不到任何其他做得更好的客户端(有些甚至不支持 blame) 。

The simple answer is that there isn't any easy way to do this. The best, most correct way would be to write your own svn client (or extend the existing one) so that it has the functionality you need. Hardly trivial.

There's also a wrong way to do it, which also involves writing code. Don't do this:

find . -type f | grep -v .svn | xargs svn blame > line_data
find . -type f | grep -v .svn | xargs svn --xml blame > xml_data

You could script the two svn commands together to avoid running find twice, but this will still be excruciatingly slow. To add insult to injury, you'll then have to parse the two files yourself to add the actual source lines into the xml data.

Sadly, I think this is the extent of the support for what you want with the standard svn client, and I can't find any other clients that do things better (some don't even support blame).

青春有你 2024-07-17 19:33:24

我不知道你正在使用什么操作系统。 但是您可以尝试使用简单的 FOR 循环和命令“svn ls -R”来递归列出分支(工作空间/url)中的所有文件,然后将其通过管道传输到“svn Blame --xml”。

我已经在 SVN 命令行提示符中尝试过这一点,并且运行良好(Windows XP、SVN 1.4.4)。 我使用的命令如下:

FOR /F "usebackq delims==" %i IN (svn ls -R http://myurl/mybranch) DO @svnblame --xml %i

注意:如果您在工作区(反映您的分支根目录)中键入此命令并使用“svn ls -R”而不是上述命令中的 url,则可以避免一些“找不到 url”类型的错误。

希望这可以帮助。

I do not know what OS you are using. But you can try using a simple FOR loop and the command "svn ls -R" to recursively list all the files in your branch (workspace/url) and then pipe it to "svn blame --xml".

I have tried this out in my SVN command line prompt and it works fine (Windows XP, SVN 1.4.4). The command I used is as follows:

FOR /F "usebackq delims==" %i IN (svn ls -R http://myurl/mybranch) DO @svn blame --xml %i

Note:You can avoid some "url not found" type of errors if you type this command in a workspace (reflecting your branch root) and use the 'svn ls -R` instead of the url in the above command.

Hope this helps.

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