[svn hooks]识别指定目录svn更新钩子

core code 奉上

## update path list
## 需要挂钩子的目录,把路径写入${SVN_LIST}变量里,以;分割即可
MXWH5_SCRIPTS=/data/workspace/scripts
PROJECT_SERVER_PATH=/data/workspace/server
PROJECT_CLIENT_PATH=/data/workspace/client
PROJECT_TOOLS_DEV_PATH=/data/workspace/tools/dev

## 需要刷新的路径列表
SVN_LIST="${MXWH5_SCRIPTS};${PROJECT_SERVER_PATH};${PROJECT_CLIENT_PATH};${PROJECT_TOOLS_DEV_PATH}"

## svn update handle
UPDATE_LIST=`echo ${SVN_LIST} | sed "s/;/ /g"`
count=1
INIT_PATH=/data/svn/hooks
for each in ${UPDATE_LIST}
do
    if [ -d ${each} ]; then
        ##  直接获取相应目录svn log 最近的版本号
        get_ver=$(svn log ${each} -r head:1 -l 1 | grep "r" | awk -F ' ' '{print $1}')
        cd ${INIT_PATH}
        check_file="${INIT_PATH}/versions/${count}"
        if [ ! -f ${check_file} ]; then
            echo "" > ${check_file}
        fi
        #echo "path: ${each}"
        #echo "get version is ${get_ver}"
        check_ver=`cat ${check_file}`
        #echo "check veriosn is ${check_ver}"
        if [ "${get_ver}" != "${check_ver}" ]; then
            #echo "${each} 版本号不同,触发update ==${get_ver}==${check_ver}=="
            /usr/bin/svn update --username svn_super --password `cat /data/save/password` ${each}
            echo ${get_ver} > ${check_file}
        fi
    fi
    count=`expr ${count} + 1`
done
上一篇:wepack源码解析1 - 流程分析


下一篇:10天掌握webpack 4.0 tapable (3) SyncWaterfallHook