svn的迁移

On 2011年02月17日, in tips, by netoearth

来源:在路上

公司的svn服务器,所有的project建立在同一个repository下,现在要给每个project分别拆分到不同的repository中。

原来的结构

repository
___/branches/project1
____________project2
____________project3
___/tags/project1
________project2
________project3
___/trunk/project1
_________project2
_________project3

现在的结构

repository1
___/branches
___/tags
___/trunk

repository2
___/branches
___/tags
___/trunk

repository3
___/branches
___/tags
___/trunk

步骤

  • svn全备份

svnadmin dump /home/svn_repository > svn.dmp

  • svn拆分

svndumpfilter –drop-empty-revs –renumber-revs include /branches/project1 /tags/project1 /trunk/project1 < svn.dmp > project1.dmp
svndumpfilter –drop-empty-revs –renumber-revs include /branches/project2 /tags/project2 /trunk/project1 < svn.dmp > project2.dmp
svndumpfilter –drop-empty-revs –renumber-revs include /branches/project3 /tags/project3 /trunk/project1 < svn.dmp > project3.dmp

–drop-empty-revs 删除空的版本信息
–renumber-revs 对版本号重新排序

  • 更改路径

将/branches/project1路径更改为/branches/, /tags/project1路径更改为/tags/,/trunk/project1路径更改为/trunk/

perl -p -i -e ‘s/project1//g’ project1.dmp

project2、project3同样

perl -p -i -e ‘s/project2//g’ project2.dmp
perl -p -i -e ‘s/project3//g’ project3.dmp

  • svn导入

svnadmin load /home/project1_repository < project1.dmp
svnadmin load /home/project2_repository < project2.dmp
svnadmin load /home/project3_repository < project3.dmp

Tagged with:  

Comments are closed.