[SVN]-How do I relocate a repository to another host?

本文介绍如何将位于Windows系统的Subversion仓库迁移到Unix系统。通过使用svnadmin dump命令导出仓库内容,并利用svnadmin load命令在新的位置加载这些内容。文章还讲解了如何更新现有工作副本以指向新的仓库位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem

You have repository on a host server and you need to relocate it to another host server.

Solution

Dump the repository and load it into the new repoitory.

Suppose your original repository is hosted on a Windows PC at d:/repositories/myrepos and your project has outgrown this temporary solution and you must now move it to a Unix system at /var/repositories/myrepos.

On the PC

svnadmin dump c:/respositories/myrepos > myrepos.dump

Transfer the dump file myrepos.dump onto the Unix host, let us suppose to the Subversion administrator's home directory. Now log in as the Subversion administrator and create a new empty repository and load the dump file.

cd ~
svnadmin create /var/repositories/myrepos
svnadmin load /var/repositories/myrepos < myrepos.dump

Do not forget that when setting up the new repository you may need to also set up your repository's configuration (depending on how you serve your repository).

Your users can now switch any exisiting working copies to the new location. This must be done using the --relocate option on thesvn switch command.

If your users previously accessed your repository at svn://subverionpc/myrepos and access the new location assvn://subversionunix/myrepos then they would use the following command in the root of each working copy.

svn switch --relocate svn://subversionpc/myrepos svn://subversionunix/myrepo

Discussion

The svnadmin dump command writes the content of a repository out to the STDOUT stream (which, in the command above, we redirect to the myrepos.dump file) in a platform independent format.

The svnadmin load command reads a stream as formatted by the svnadmin dump command from the STDIN stream (which, in the command above, we redirect from the myrepos.dump file) and loads it into an existing repository.

The svnadmin command works with direct access to the repository's file system, so here we are using the file myrepos.dump to store the stream output from svnadmin dump and transfer it to the Unix machine where we use the svnadmin load command to load it into the new repository.

Repositories are identified internally by a UUID (Universally Unique IDentifier). When you create a new repository with svnadmin create the repository will have a new UUID. If the repository maintained this UUID after you loaded the content from the original repository your users would be unable to reuse their existing working copies using the svn switch --relocate command. Attempting to switch a working copy to a repository with a different UUID to the repository from which the working copy was created will be prevented by the Subversion client. To avoid this problem, when svnadmin load is used on a new, empty repository  the UUID of the original repository (written into the dump file by the svnadmin dump command) it written into the new repository.

 

For further information about using Subversion, try the complete Subversion training course "Subversion Guru".

Category

Tags for this item

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值