有人有一个很好的 awk 来输出 svn 日志吗?
我想搜索提交消息中的字符串,很容易将 svn log 通过管道传输到 grep,但因为消息和 rev 位于不同的行,所以有点复杂。
即
svn 日志 ./ | searchSvnMessages.awk artf29999
------------------------------------------------------------------------
r9303 | myuser | 2011-02-22 15:13:47 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adjusting Skin
------------------------------------------------------------------------
r9302 | myuser | 2011-02-22 14:11:06 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adding skinning.
------------------------------------------------------------------------
r800 | myuser | 2011-02-22 09:44:36 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adding functionality.
我希望其他人已经完成了我可以利用的肮脏工作?
I want to search the commit messages for a string, it's easy to pipe svn log to a grep, but because the message and the rev are on separate lines, it's a little more complicated.
i.e.
svn log ./ | searchSvnMessages.awk artf29999
------------------------------------------------------------------------
r9303 | myuser | 2011-02-22 15:13:47 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adjusting Skin
------------------------------------------------------------------------
r9302 | myuser | 2011-02-22 14:11:06 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adding skinning.
------------------------------------------------------------------------
r800 | myuser | 2011-02-22 09:44:36 -0800 (Tue, 22 Feb 2011) | 1 line
artf29999: Adding functionality.
I was hoping that someone else had done the dirty work that I could piggyback on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只需要搜索每个日志条目的第一行并且您使用的是 GNU grep,则可以执行 svn log 。 | grep -B2 artf29999。
If you only need to search the first line of each log entry and you are using GNU grep, you can do
svn log . | grep -B2 artf29999
.您还可以使用 svn log ... --xml 来获取 xml 输出,这可能更容易解析。或者,您可以使用各种脚本绑定来获取更丰富的对象,而不是解析。
You can also use
svn log ... --xml
to get xml output, which might be easier to parse. Alternatively you can use various script bindings to get richer objects instead of parsing.