分享一個linux下svn合并指令碼

來源:互聯網
上載者:User


分享一個linux下svn合并指令碼 #!/bin/bash# svn合并指令碼  www.2cto.com   # svn版本庫地址BRANCHES_URL=svn://xxx; # 版本號碼version=$1 if [[ $# == 0 ]]; then    usage;    exit;fi if [ $? -ne 0 ]; then    echo '版本號碼必須是數值'    exitfi echo '--------------------------------------[開始]--------------------------------------' # 把要執行動作和對應檔案的svn分支路徑記錄到臨時檔案中svn log -r $version -qv $BRANCHES_URL | grep / | awk "{print \$1\$2}" > /tmp/svn_merge_info i=1for f in `cat /tmp/svn_merge_info`do     # 擷取執行的動作類型    svn_cmd=`expr substr $f 1 1`    f=`echo $f | sed -e "s/^.//"`    # 擷取檔案路徑 如:/js/test.js (檔案分支路如徑:/branches/master/js/test.js | /trunk/js/test.js)    local_f=`echo $f | sed -e "s/\/branches\/[^/]*//" | sed -e "s/\/trunk//"`    case $svn_cmd in    A)        tmp="svn copy -r $version ${BRANCHES_URL}$f .$local_f"    ;;    M)        tmp="svn merge -r $((version-1)):$version --ignore-ancestry $BRANCHES_URL$f .$local_f"    ;;    D)        tmp="svn del .$local_f"    ;;    *)    echo "暫不支援的命令"    exit    ;;    esac    echo ''    echo "執行命令:$tmp"    echo ''    echo "結果:"        ttmp=`$tmp`        result=$?        echo $ttmp    echo ''    echo "----------------------------------------$i----------------------------------------"    i=`expr $i + 1`    done # 擷取分支名稱tmp_branche=`svn log $BRANCHES_URL -r $version -qv | tail -n 2 | head -n 1 | sed -r -e "s/.*branches\/([^/]*).*/\1/"`branche=$tmp_branchesvn commit -m "從$branche分支的$version版本合并,並自動認可"     echo '--------------------------------------[結束]--------------------------------------' 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.