zoukankan      html  css  js  c++  java
  • shell 脚本合并分支到主干

    svn copy -r 73 svn://xxx/branches/test/main/aBeauty.inc.php ./main/aBeauty.inc.php

     

    svn merge -r 72:73 --ignore-ancestry svn://xxx/branches/test/main/aBeauty.inc.php ./main/aBeauty.inc.php

     

     

     

    #!/bin/bash
    
    # 加载公共函数
    source ~/common.sh
    
    #curr_dir=`dirname $(get_curr_dir $0)`
    curr_dir=/usr/local/var/www/svn_tools
    source $curr_dir"/config.sh"
    
    PROGNAME=`basename $0`;
    BRANCHES_URL=svn://xxx/xxx;
    
    function usage() {
        echo "用法:"
        echo "      $PROGNAME 版本号"
    }
    
    if [[ $# == 0 ]]; then
        usage;
        exit;
    fi
    
    version=$1
    
    expr $version + 1
    
    if [ $? -ne 0 ]; then
        echo '版本号必须是数值'
        exit
    fi
    
    svn log -r $version -qv $BRANCHES_URL | grep / | awk "{print $1$2}" > /tmp/svn_merge_info
    
    for f in `cat /tmp/svn_merge_info`
    do
        svn_cmd=`echo ${f:0:1}`
        f=`echo $f | sed -e "s/^.//"`
        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 ''
        echo ''
        echo ''
    done
    
    if [[ -s '/tmp/svn_merge_info' ]]; then
        status=`svn info | grep "/trunk"`
        if [[ -n $status ]]; then
            echo ;
            #$curr_dir"/packjs_tuan_trunk.sh"
            #$PHP_BIN $curr_dir"/sszt_change_statics_version.php" '/tmp/svn_merge_info'
        fi
    fi

    common.sh

    #!/bin/bash

     

    function get_curr_dir()

    {

        if [ -L $1 ]; then

            # 获取软连接所指向的文件名

            ls -l $1 | awk "{print $11}"

        else

            echo $1

        fi  

    return 0

           

    if [ ! -f $real_file ]; then

        echo $real_file":不是正规文件" 

        exit

    fi  

    }

     

    config.sh

     

    #!/bin/bash

      

    SVN_TOOLS_DIR=$(dirname $0)

    PHP_BIN="/usr/local/Cellar/php54/5.4.37/bin/php"

    ~ 

  • 相关阅读:
    IOS 给一个文本框,按钮,view加虚线边框
    AFNetworking 使用  基础篇
    IOS——中级篇 --TableView以及Cell
    IOS中级篇 —— picKerView and DatePicKer
    IOS中级篇 ——自动布局 Autolayout  and  VFL
    IOS中级篇—— 多线程--NSOperation
    IOS中级篇 —— Autoresizing
    IOS中级篇 —— 字典转模型
    IOS中级篇 —— 关于深复制和浅复制
    IOS中级篇 —— 日期时间对象
  • 原文地址:https://www.cnblogs.com/bandbandme/p/10620847.html
Copyright © 2011-2022 走看看