SVN 遷移某一特定目錄下的項目代碼

Original researched by Hans. Shared on CSDN.

What can it do for us:
Migrate a single project from a specify repository to a new svn repository and keep all commit history/Log.

E.g. 
This is the layout of old svn server
/
	repos/		
		DL/
			trunk/
			branches/
			tags/
		Some other projects...
		Xotix/
			trunk/
			branches/
			tags/

And this is the layout of our new svn server
/
	repos/
		ProjectA/
			trunk/
			branches/
			tags/
		Some other projects...
	EMRepos/
		<new empty repository>
	
Our task is migrate Xotix to new sver server, and it's better to separate with other team projects.
Here are the cmds what we need:

1. Backup the old repository base on the reversion number of target project (NOTE: the result dump file can NOT be loaded to new svn repository directly)
svnadmin dump D:\Repositories\repos --incremental -r 35860:38312 > D:\35860.dump

2. Filter target project (NOTE: the path is case sensitive, and the '/' is also improtent)
svndumpfilter include /Xotix /Xotix/trunk /Xotix/branches /Xotix/tags < 35860.dump > Xotix.dump

3. Load project to new svn repository
svnadmin load D:\Repositories\EMRepos < Xotix.dump

Combine step 1 & 2:
svnadmin dump D:\Repositories\repos --incremental -r 35860:38312 | svndumpfilter include /Xotix /Xotix/trunk /Xotix/branches /Xotix/tags > D:\Xotix.dump


For more info about the cmd, you can refer to this link:
http://svnbook.red-bean.com/en/1.8/svn.reposadmin.maint.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章