如何导出(然后导入)Subversion 存储库? [英] How do I export (and then import) a Subversion repository?

查看:20
本文介绍了如何导出(然后导入)Subversion 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将完成一个项目,在该项目中我使用商业 SVN 提供商来存储源代码.客户最终选择的网络主机包含一个存储库作为托管包的一部分,因此,现在项目已经结束,我想将存储库迁移到他们的网络主机并停止使用商业帐户.

I'm just about wrapped up on a project where I was using a commercial SVN provider to store the source code. The web host the customer ultimately picked includes a repository as part of the hosting package, so, now that the project is over, I'd like to relocate the repository to their web host and discontinue the commercial account.

我该怎么做?

推荐答案

如果您想移动存储库并保留历史记录,您可能需要在两台主机上访问文件系统.如果您的后端是 FSFS(最新版本的默认设置),最简单的解决方案是制作整个存储库文件夹的文件系统副本.

If you want to move the repository and keep history, you'll probably need filesystem access on both hosts. The simplest solution, if your backend is FSFS (the default on recent versions), is to make a filesystem copy of the entire repository folder.

如果你有一个 Berkley DB 后端,如果你不确定你的后端是什么,或者如果你正在改变 SVN 版本号,你会想要使用 svnadmin 来转储你的旧存储库并加载它进入您的新存储库.使用 svnadmin dump 将为您提供单个文件备份,您可以将其复制到新系统.然后,您可以创建新的(空)存储库并使用 svnadmin load,这将重播所有提交及其元数据(作者、时间戳等).

If you have a Berkley DB backend, if you're not sure of what your backend is, or if you're changing SVN version numbers, you're going to want to use svnadmin to dump your old repository and load it into your new repository. Using svnadmin dump will give you a single file backup that you can copy to the new system. Then you can create the new (empty) repository and use svnadmin load, which will essentially replay all the commits along with its metadata (author, timestamp, etc).

您可以在此处阅读有关转储/加载过程的更多信息:

You can read more about the dump/load process here:

http://svnbook.red-bean.com/en/1.8/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate

此外,如果您执行 svnadmin load,请确保使用 --force-uuid 选项,否则人们将在切换到新存储库时遇到问题.Subversion 使用 UUID 在内部标识存储库,它不会让您将工作副本切换到不同的存储库.

Also, if you do svnadmin load, make sure you use the --force-uuid option, or otherwise people are going to have problems switching to the new repository. Subversion uses a UUID to identify the repository internally, and it won't let you switch a working copy to a different repository.

如果您没有文件系统访问权限,那么可能还有其他第三方选项(或者您可以编写一些内容)来帮助您迁移:本质上,您必须使用 svn 日志来重播新版本上的每个修订版存储库,然后修复元数据.您需要准备好 pre-revprop-change 和 post-revprop-change 钩子脚本来执行此操作,这假定文件系统访问,所以 YMMV.或者,如果您不想保留历史记录,您可以使用您的工作副本导入到新的存储库中.但希望事实并非如此.

If you don't have filesystem access, there may be other third party options out there (or you can write something) to help you migrate: essentially you'd have to use the svn log to replay each revision on the new repository, and then fix up the metadata afterwards. You'll need the pre-revprop-change and post-revprop-change hook scripts in place to do this, which sort of assumes filesystem access, so YMMV. Or, if you don't want to keep the history, you can use your working copy to import into the new repository. But hopefully this isn't the case.

这篇关于如何导出(然后导入)Subversion 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆