将目录迁移到不同的 svn 存储库

发布于 2024-08-06 09:15:41 字数 394 浏览 1 评论 0原文

我在 svn 存储库中有代码,将其称为存储库 A。现在假设我需要将内容移动到存储库 B,但存储库 B 已经对其他项目处于活动状态一段时间了。是否可以将特定目录从存储库 A 移动到存储库 B,同时保留文件历史记录?通常,要将整个存储库迁移到新服务器,我会这样做:

svnadmin dump -r 0:179 rep_a > rep_a.dump
svnadmin create rep_b
svnadmin load rep_b < rep_a.dump

但是,这会作用于整个存储库,并假设存储库 B 一开始是空的(我认为)。我当然可以导出有问题的目录并将其导入存储库 B,但我丢失了版本历史记录。

有没有一种简单的方法可以将特定目录从 A 移动到 B 而不会丢失版本历史记录?

I have code in an svn repository, call it repository A. Now say that I need to move the contents to repository B, but repository B has already been active for a while for other projects. Is it possible to move a particular directory from repository A to repository B, preserving the file history? Normally, to migrate an entire repository to a new server, I would do:

svnadmin dump -r 0:179 rep_a > rep_a.dump
svnadmin create rep_b
svnadmin load rep_b < rep_a.dump

However, this acts on the whole repository and assumes repository B is empty to start with (I think). I can of course export the directory in question and import it into repository B, but I lose the version history.

Is there an easy way to move a particular directory from A to B without losing the version history?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

緦唸λ蓇 2024-08-13 09:15:41

假设您要将 rep_atrunk/project 目录复制到 rep_b 中,则必须使用以下命令:

svnadmin dump rep_a | svndumpfilter include trunk/project | svnadmin load rep_b

相关的修订rep_a 将被添加到 rep_b 的历史记录中。

当然,要小心并提前做好备份。此外,如果您有公共目录,那么您将必须从转储中删除目录创建(以避免创建相同的目录两次),这可能会很棘手。

Let's say you want to copy directory trunk/project of rep_a into rep_b, you have to use this command:

svnadmin dump rep_a | svndumpfilter include trunk/project | svnadmin load rep_b

The revisions related to rep_a will be added to the history of rep_b.

Be careful with that and make a backup before, of course. Also, it can be tricky if you have common directories, then you will have to remove directory creations from the dump (to avoid creating the same directories twice).

老街孤人 2024-08-13 09:15:41

查看过滤存储库历史记录 在 SVN 书中。

Look at Filtering Repository History in the SVN book.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文