如何将 SVN 存储库中的子树提取到新存储库中?

发布于 2024-07-14 01:08:51 字数 334 浏览 4 评论 0原文

我们有一个 Subversion 存储库,其中一个目录是:

  • 并不真正需要超出 RCS 功能的修订控制
  • 不与存储库中的其他任何内容一起进行版本化
  • 修改频率大约是存储库其余部分的六倍

虽然我知道这一点很高修订号不是问题,尽管如此,我想将这个目录从我的主存储库中取出并放入第二个目录,最好是新目录。

最好的流程是什么? 如果有什么不同的话,SVN 存储库托管在(...检查...)FreeBSD 机器上。

值得注意的是,虽然我需要在新存储库中保留版本历史记录,但无需删除旧存储库中的内容; 我不在乎,它就可以坐在那里。

We have a Subversion repository with one directory that is:

  • Not really in need of revision control beyond the capabilities of RCS
  • Not versioned in conjunction with anything else in the repository
  • Modified about six times as often as the rest of the repository

Although I know that high revision numbers aren't a problem, nonetheless I'd like to pull this one single directory out of my main repository and into a second, ideally new one.

What is the best process for that? If it makes a difference, the SVN repository is hosted on a (... checks... ) FreeBSD machine.

It's worth noting that while I need to retain the version history in the new repository, there's no need to obliterate the content in the old; it can just sit there, for all I care.

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

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

发布评论

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

评论(4

み零 2024-07-21 01:08:51

您可以使用svnadmin dumpsvnadmin load从原始存储库创建一个新存储库; 然后将不适合您的方案的目录复制到更好的位置,然后删除其他所有内容。 在原始存储库中,您只需删除不合适的目录即可。 这使所有历史记录保持完整,并且您最终会得到两个存储库。

可能有一种方法可以随后从历史记录中当时无用的部分中清除两个存储库(svndumpfilter),但由于硬盘空间非常便宜,我认为没有必要。 无论如何,SVN 文档 拥有有关它的所有信息。

You could use svnadmin dump and svnadmin load to create a new repository from the original one; then copy the directory that doesn't really fit into your scheme to a better location, then delete everything else. In the original repository you would simply delete the non-fitting directory. This keeps all history intact, and you end up with two repositories.

There is probably a way to subsequently clean both repositories from the then useless parts of the history (svndumpfilter), but since hard disc space is quite cheap I wouldn't think this necessary. Anyway, the SVN documentation has all the information about it.

萌无敌 2024-07-21 01:08:51

推荐的方法是使用 svnadmin dump,然后使用 svndumpfilter 工具过滤转储文件(请参阅svnbook)。

例如,我有一个带有名为“Model”的顶级目录的存储库,我想将其移动到自己的存储库:

svnadmin dump my_orig_repo | svndumpfilter include --drop-empty-revs --renumber-revs Model >model_only.svndump
svnadmin load my_model_repo < model_only.svndump

这将创建仅包含模型子目录的新存储库。

要将其从原始存储库中删除,您只需执行 svn rm 即可。 这将从最新版本的存储库中删除它,这是最简单的方法。

但如果我的示例中的模型目录非常大,也许我会想将其从原始目录中完全删除。 我可以通过重复该过程来创建另一个过滤的 svn 转储文件,排除它。 然后我将用没有排除目录的新目录替换原来的目录。

The recommended way to do this is to use svnadmin dump, then filter the dump file with the svndumpfilter tool (see svnbook).

For example, I had a repo with a top-level directory named 'Model', which I wanted to move to its own repo:

svnadmin dump my_orig_repo | svndumpfilter include --drop-empty-revs --renumber-revs Model >model_only.svndump
svnadmin load my_model_repo < model_only.svndump

That creates the new repo with only the Model subdirectory.

For removing it from the original repository, you can simply do an svn rm. This will remove it from the latest version of the repo, and is the simplest way.

But if the Model directory from my example was very large, maybe I would have wanted to remove it entirely from the original. I could do that by repeating the process to create another filtered svn dump file that excluded it instead. Then I would replace the original with the new one that did not have the excluded directory.

李不 2024-07-21 01:08:51

我将导出(而不是检出)目录,将其导入到新存储库中,然后从原始存储库中删除它(当然,带有一条指示其去向的日志消息;-)。

这可能是也可能不是“最好”的方法......

I would export (not checkout) the directory, import it into the new repository, then delete it from the original (with a log message indicating where it went, of course ;-).

That may or may not be the "best" way to do it...

冷血 2024-07-21 01:08:51

我不知道我是否理解正确,但有一个很好的解决方案。 如果您的原始存储库位于 svn://domain,并且您经常使用的文件夹称为“文件夹”,我相信您可以简单地执行以下命令:svn co svn://domain/folder 仅签出该文件夹。

I don't know if I understand this correctly, but there's a nice solution to that. If your original repository was at svn://domain, and the folder you use a lot is called "folder", I believe you can simply perform the following command: svn co svn://domain/folder to checkout only that folder.

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