Moving a Subversion Repository to Another Server

本文详细介绍了如何将Subversion仓库从一台服务器迁移到另一台服务器,并将其拆分为多个独立仓库的过程。通过备份原始仓库、过滤文件夹、创建新仓库并导入旧仓库数据,实现仓库的高效迁移。

Moving a subversion repository from one server to another, while still preserving all your version history may seam like a daunting task, but fortunately it's not too difficult.

I recently had to move a subversion (svn) repository to another server. The repository was on a Windows server and had to be moved to another, the old repository looks like below:

#repositories

--repository

----branch

----tags

----trunk

--------projects

----------calc/

----------cal/

----------spreadsheet/

 

Now I want to move each project into separate repository, looks like below:

#repositories

--CalcRepository

----branch

----tags

----trunk

--CalRepository

----branch

----tags

----trunk

--SpreadsheetRepository

----branch

----tags

----trunk

 

 

Step 1: Backup your old Repository

The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump's with a backup script, but if not here's how you can create a subversion dump file:

$ svnadmin dump D:\Repositories\repository > D:\svn_backup\all_repo.dump

 

Use the --revision (-r) option to specify a single revision, or a range of revisions, to dump. If you omit this option, all the existing repository revisions will be dumped.

$ svnadmin dump myrepos -r 23 > rev-23.dumpfile
$ svnadmin dump myrepos -r 100:200 > revs-100-200.dumpfile

 

STEP 2: FILTER FOLDER FROM DUMP FILE

$ svndumpfilter include trunk/projects/calc < D:\svn_backup\all_repo.dump > D:\svn_backup\calc.dump

$ svndumpfilter include trunk/projects/cal < D:\svn_backup\all_repo.dump > D:\svn_backup\cal.dump

$ svndumpfilter include trunk/projects/spreadsheet < D:\svn_backup\all_repo.dump > D:\svn_backup\spreadsheet.dump

 

At this point, you have to make a decision. Each of your dump files will create a valid repository, but will preserve the paths exactly as they were in the original repository. This Repository Administration means that even though you would have a repository solely for your calc project, that repository would still have a top-level directory named calc. If you want your trunk, tags, and branches directories to live in the root of your repository, you might wish to edit your dump files, tweaking the Node-path and Node-copyfrom-path headers so that they no longer have that first calc/ path component. Also, you'll want to remove the section of dump data that creates the calc directory. It will look something like the following:

Node-path:  /trunk/projects/calc    => /trunk

Node-copyfrom-path: /trunk/projects/calc    => /trunk

 

The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision).

 

Step 3: Create the new Repository

Now, simply transfer the dump file on to your new subversion server, and create an empty repository:

 

$ svnadmin create D:\Repositories\CalcRepository

$ svnadmin create D:\Repositories\CalRepository

$ svnadmin create D:\Repositories\SpreadSheetRepository

 

Step 4: Import your old repository into the new one

Next import your dump file:

 

$ svnadmin load CalcRepository < D:\svn_backup\calc.dump

$ svnadmin load CalRepository < D:\svn_backup\calc.dump

$ svnadmin load SpreadsheetRepository < D:\svn_backup\Spreadsheet.dump

 

转载于:https://www.cnblogs.com/ludbul/p/4369098.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值