现在的位置: 首页 > 综合 > 正文

shell 脚本:svn 查找用户,并导出修改文件

2018年03月21日 ⁄ 综合 ⁄ 共 793字 ⁄ 字号 评论关闭
#!/bin/bash
STR_FRUIT=`svn log /home/chen/www/JUANPI_V3/ -v -l100 | grep cunzhang`
no_df=''
IFS_old=$IFS
IFS='行'

for version_number in $STR_FRUIT
do
    #获取版本号
    no_df=${version_number%| cunzhang |*}
    no_df=${no_df#*r}

if [  $no_df ]; then
    
    #获取日志列表
    exec_command="svn log -r $no_df -v"
    re_svn_list=$(eval $exec_command)

    #获取bug号
    bug_n=$re_svn_list
    bug_n=${bug_n#*bug #} 
    bug_n=${bug_n:0:4}
	
    myPath="/home/chen/www/bug_$bug_n";
    if [ ! -x "$myPath" ]; then  
	mkdir "$myPath"  
    fi  

    re_svn_list=${re_svn_list#*改变的路径:} 
    re_svn_list=${re_svn_list%fix bug*}
    IFS=$IFS_old
    for filelist in $re_svn_list
    do 
	if [  $filelist ]; then
		#echo $file_list;
		str10=${filelist:0:10}
		if [ "$str10" = "/branches/" ]; then  
		    filelist=${filelist:24:100}
		    
		    file_dir=$myPath/$filelist;
	            file_dir=${file_dir%/*}
                    if [ ! -x "$file_dir" ]; then  
			mkdir -p "$file_dir"  
		    fi  

				
		    cp /home/chen/www/$filelist $myPath/$filelist;
		fi  
		
	fi
	
    done

fi 
done

IFS=$IFS_old

抱歉!评论已关闭.