2013-04-23 210 views
2

通常当我做一个svn log -v提取信息,我得到了格式的响应:从SVN日志

------------------------------------------------------------------------ 
r8223 | neo | 2013-04-23 10:51:46 +0200 (Tue, 23 Apr 2013) | 1 line 
Changed paths: 
    M /dir/myfile.py 

mycomment: validation changes for customers 
------------------------------------------------------------------------ 

但是说,我要列出所有的版本号为SVN提交,其中有“验证的变化“在他们的评论中。我该如何列出?

svn log -l 1000 -v | grep“validation changes”| awk'{print $ somevalue}' 也不帮忙,因为它只是评论位的一部分!

+1

你可以做'SVN日志--xml '得到xml输出。你可以将它传递给python脚本或任何你喜欢解析和搜索我猜.. – Blorgbeard 2013-04-23 09:46:25

+0

谢谢@Blorgbeard,但我想要的东西更简单,除了必须在python中编写工具,首先解析,搜索模式并格式化输出。可能我会在没有其他选项的情况下继续使用它。 – neoInfinite 2013-04-23 10:09:45

+0

您将不得不编写脚本来解析日志。使用XPath查询可能会更简单快捷。如果你手动解析XML,你可能做错了。 – alroc 2013-04-23 11:04:34

回答

0

Subversion 1.8+命令行客户端允许您使用新的--search--search-and选项和svn log命令。

命令不执行全文搜索一个仓库里,并认为只有以下数据:

  • 修订的作者(svn:author版本化的属性),
  • 日期(svn:date版本化的属性),
  • 日志消息文本(svn:log未版本控制的属性),
  • 已更改路径(即受特定修订影响的路径)的列表。

下面是这些新的搜索选项的帮助页面:

If the --search option is used, log messages are displayed only if the 
provided search pattern matches any of the author, date, log message 
text (unless --quiet is used), or, if the --verbose option is also 
provided, a changed path. 
The search pattern may include "glob syntax" wildcards: 
    ?  matches any single character 
    *  matches a sequence of arbitrary characters 
    [abc] matches any of the characters listed inside the brackets 
If multiple --search options are provided, a log message is shown if 
it matches any of the provided search patterns. If the --search-and 
option is used, that option's argument is combined with the pattern 
from the previous --search or --search-and option, and a log message 
is shown only if it matches the combined search pattern. 
If --limit is used in combination with --search, --limit restricts the 
number of log messages searched, rather than restricting the output 
to a particular number of matching log messages. 
你的情况

所以命令可能是:

svn log -v --search "validation changes" URL-TO-REPOSITORY | awk '{print $somevalue}'