zoukankan      html  css  js  c++  java
  • 〖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

  • 相关阅读:
    NOIP 2018 day1 题解
    公司管理与信息化基础成熟度模型
    信息化成熟度整体评估模型
    审计抽样
    正态分布
    函证决策
    SALESORDERINCOME.QVW
    ERP上线通用模板
    可转换债券分拆
    luogu 1373 小a和uim之大逃离 dp
  • 原文地址:https://www.cnblogs.com/scue/p/4379669.html
Copyright © 2011-2022 走看看