从svn日志中提取信息

时间:2013-04-23 09:40:16

标签: svn logging version-control

通常当我执行svn log -v时,我会收到以下格式的回复:

------------------------------------------------------------------------
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“验证更改”| awk'{print $ somevalue}' 也没有帮助,因为它只是评论位的一部分!

1 个答案:

答案 0 :(得分:0)

Subversion 1.8+命令行客户端允许您在--search命令中使用新的--search-andsvn 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}'