svn传输文件

    技术2026-01-05  5

    每次开发项目完后,要测试代码,代码总会出现bug,bug改好后需要传文件到正式服务器上去:

    方法1:

        在服务器端设置svn自动更新;

        需要共用一台svn服务器

    方法2:

        每一次改一个文件ftp传到服务器上去。 

     

     在linux我选择了第二种(繁琐),后来我写了一个shell脚本来处理当前目录下更改的文件:

        path=${PWD} cd $path #服务器www目录 despath="/server/www/" echo $despath tmpfile=/tmp/svnfile if [ -f "$tmpfile" ]; then rm -f $tmpfile fi svn st | awk '{if($1=="M" || $1=="A"){print $2;} }' > $tmpfile len=`wc -l < $tmpfile` echo $len i=0 #切换到当前www的工作目录 cd /home/wyt/www/ while true do if [ ! $i -lt 4 ]; then break fi nline=`expr $len - $i` files=`tail --lines=$nline $tmpfile | head -1` echo "$files" boots=`dirname $files` scp $files wyt@ip:"${despath}${boots}/" i=`expr $i + 1` echo "$i" done

    最新回复(0)