开发者

Does anyone have a nice awk for svn log output?

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜