首页 > 系统服务 > 详细

〖Linux〗svn log 每个日志记录只显示一行的方法

时间:2015-03-31 06:16:42      阅读:517      评论:0      收藏:0      [点我收藏+]

vi ~/.bashrc,增加一个function

 

 1 svnlog(){
 2     svn log "$@" | awk -f <(cat <<EOF
 3 #!/usr/bin/awk -f
 4 
 5 # Convert the "svn log" output into a one liner format, which is easier to grep
 6 # or use in scripts. Pipe "svn log" into this script
 7 
 8 # When we get a line that starts with a revision number, put the data in variables
 9 /^r[0-9]+/ {
10     rev=\$1
11     user=\$3
12     date=\$5
13     time=\$6
14     lines=13
15 }
16 
17 # Anything that isnt a revision line, a separator line or an empty line
18 # will be part of the commit message. Concatenate these into the comment variable
19 ! (/^r[0-9+]/ || /^-+$/ || /^$/) {
20   comment = comment \$0
21 }
22 
23 # With every separator line, output what we stored before and reset the comment variable
24 # To skip the first line we also check if weve already stored a revision
25 /^-+$/ && rev {
26    print rev " | " user " | " date " | " time " | " comment
27    comment = ""
28 }
29 EOF
30 )
31 }

 awk正则表达式参考的是:https://gist.github.com/plexus/1485222

使用方法:svnlog -l 10

技术分享

 

〖Linux〗svn log 每个日志记录只显示一行的方法

原文:http://www.cnblogs.com/scue/p/4379669.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!