*迭代 分支回收、创建偷懒脚本
用当前日期比如今天:20171030 为规则,在分支目录branches下创建分支
@echo off set branchName=%Date:~0,4%%Date:~5,2%%Date:~8,2% rem 获取分支名字 rm -rf .\a.txt svn info | grep URL | awk 'NR==2' |awk 'END{print $1}' > a.txt rem 获取svn 远端地址 set /p remote=<a.txt svn cp %remote%/trunk %remote%/branches/%branchName% -m "created a new branch using autoCreateNewBranch.bat : "%remote%/branches/%branchName% rem 创建分支 rm -rf .\a.txt |
回收branches下所有分支到tag
【如果当前迭代不止一个分支,请手工迁移,当前脚本不适用】
@echo off rm -rf .\b.txt rm -rf .\list.txt svn info | grep URL | awk 'NR==2' |awk 'END{print $2}' > b.txt rem 获取svn 远端地址 set /p remote=<b.txt svn list %remote%/branches > list.txt for /f %%i in (list.txt) do svn mv %remote%/branches/%%i %remote%/tag -m "move branch:'%remote%/branches/%%i ' to tag using moveAllBranchesToTag.bat" rem 移动到tag目录下。记录日志 rm -rf .\b.txt rm -rf .\list.txt |
使用方法:将上诉脚本,创建 *.bat 文件,放在svn根目录下。 按需执行即可