将 Subversion 存储库拆分为多个 Mercurial 存储库?

发布于 2024-10-03 05:32:44 字数 523 浏览 9 评论 0原文

我们正在从 Subversion 迁移到 Mercurial,并且在 SVN->Hg 转换过程中遇到了障碍。目前,我们的单个 SVN 存储库保存了几个不同“项目”的代码,我们希望在迁移过程中将它们分开。我们的 SVN 存储库的组织方式如下:

.
|-- proj1
|   |-- branches
|   |-- tags
|   `-- trunk
`-- proj2
    |-- branches
    |-- tags
    `-- trunk

我们希望简单地将 proj1proj2 创建为他们自己的 Hg 存储库。当然,我们也不希望 proj1 特定的历史记录出现在 proj2 的日志中。现在,当 hg Convert 进行转换时,它只是非常愚蠢地读取所有文件,甚至不区分分支和主干。

hg Convert 中按目录过滤和识别 SVN 分支的过程是怎样的?

We're migrating from Subversion to Mercurial and have run into a bump in the SVN->Hg conversion process. Right now, our single SVN repo holds code for a couple distinct "projects", and we'd like to split them apart in the migration process. Our SVN repo is organized as:

.
|-- proj1
|   |-- branches
|   |-- tags
|   `-- trunk
`-- proj2
    |-- branches
    |-- tags
    `-- trunk

and we'd like to simply make proj1 and proj2 their own Hg repos. We'd like to, of course, not have history specific to proj1 appear in proj2's log either. Right now, when hg convert does the conversion, it just reads all the files pretty dumbly, not even distinguishing branches from trunks.

What's the process for filtering by directory and recognizing SVN branches in hg convert?

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

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

发布评论

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

评论(3

清风不识月 2024-10-10 05:32:44

感谢 ConvertExtension wiki 页面,我现在已经可以使用它了!

我尝试了 Ry4an 的方法,但它的缺点是必须先将 SVN 存储库转换为中间 Mercurial 存储库,然后再拆分所有内容,并且分支、主干和标签无法被识别,因为有两个项目,每个项目都有自己的分支、主干和标签。

我发现手动指定分支、主干和标签目录对于一次将一个项目从 SVN 转换为 Mercurial 非常有用:

hg \
--config convert.svn.trunk=proj1/trunk \
--config convert.svn.branches=proj1/branches \
--config convert.svn.tags=proj1/tags \
convert --authors authors.txt original-svn-dir hg-proj1

这将负责识别 SVN 分支、标签和主干过滤器同时仅进行 proj1 修订。然后,我只是对 proj2 重复了它。

I've got it working now, thanks to the ConvertExtension wiki page!

I tried Ry4an's method, but it came with the downsides of having to first convert the SVN repo into an intermediate Mercurial repo before splitting everything, and that branches, trunk, and tags weren't being recognized because there are two projects each with their own branches, trunk, and tags.

I found that manually specifying the branches, trunk, and tags directory worked great for converting one project from SVN to Mercurial at a time:

hg \
--config convert.svn.trunk=proj1/trunk \
--config convert.svn.branches=proj1/branches \
--config convert.svn.tags=proj1/tags \
convert --authors authors.txt original-svn-dir hg-proj1

This will take care of recognizing SVN branches, tags, and trunk and filter for only proj1 revisions at the same time. Then, I just repeated it for proj2.

淡看悲欢离合 2024-10-10 05:32:44

解决这个问题的另一种方法是使用 svnadmin dump 和 svndumpfilter 将 svn 存储库拆分为每个项目一个新的 svn 存储库,如 svn 文档中所述。
通过过滤存储库历史记录来分割存储库< /a>

Another way to solve it would be to use svnadmin dump and svndumpfilter to split the svn repo into one new svn repository per project as described in the svn documentation.
Splitting repositories by filtering repository history

岁月流歌 2024-10-10 05:32:44

正如您所建议的,使用“转换”扩展可以轻松完成此操作。过程如下:

  1. 执行一个 hg Convert SVNREPO all-in-one-mercurial-repo 从 svn 到 Mercurial,所有内容都
  2. 执行多个 hg Convert --filemap projectfilemap.txt all-in-one- Mercurial-repo project-repo 命令——每个项目一个

这些文件映射中包含如下行:

exclude proj1
rename proj2 .

这将是从一体式 Mercurial 存储库中提取项目二的存储库时使用的文件映射。您可能需要列出这些映射中的每个单独文件,但我认为目录是可以的。

这里还有另一个问题,我回答了几乎相同的问题,并粘贴了一个完整的示例,但这应该足以让你继续下去。

This is easily done using the 'convert' extension as you've suggested. Here's the procedure:

  1. do a hg convert SVNREPO all-in-one-mercurial-repo from svn to mercurial with everything
  2. do multiple hg convert --filemap projectfilemap.txt all-in-one-mercurial-repo project-repo commands -- one per project

Those filemaps have in them lines like:

exclude proj1
rename proj2 .

That would the the filemap used when extracting just project two's repo from the all-in-one mercurial repo. You may need to list each individual file in those maps, but I think directories are okay.

There's another question here on SO where I answered pretty much the same thing and pasted in a full example, but that should be enough to get you going.

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