〖Linux〗svn log 每个日志记录只显示一行的方法
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 isn‘t 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 we‘ve 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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。