将 Subversion 存储库拆分为多个 Mercurial 存储库?
我们正在从 Subversion 迁移到 Mercurial,并且在 SVN->Hg 转换过程中遇到了障碍。目前,我们的单个 SVN 存储库保存了几个不同“项目”的代码,我们希望在迁移过程中将它们分开。我们的 SVN 存储库的组织方式如下:
.
|-- proj1
| |-- branches
| |-- tags
| `-- trunk
`-- proj2
|-- branches
|-- tags
`-- trunk
我们希望简单地将 proj1
和 proj2
创建为他们自己的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢 ConvertExtension wiki 页面,我现在已经可以使用它了!
我尝试了 Ry4an 的方法,但它的缺点是必须先将 SVN 存储库转换为中间 Mercurial 存储库,然后再拆分所有内容,并且分支、主干和标签无法被识别,因为有两个项目,每个项目都有自己的分支、主干和标签。
我发现手动指定分支、主干和标签目录对于一次将一个项目从 SVN 转换为 Mercurial 非常有用:
这将负责识别 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:
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 forproj2
.解决这个问题的另一种方法是使用 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
正如您所建议的,使用“转换”扩展可以轻松完成此操作。过程如下:
hg Convert SVNREPO all-in-one-mercurial-repo
从 svn 到 Mercurial,所有内容都hg Convert --filemap projectfilemap.txt all-in-one- Mercurial-repo project-repo 命令——每个项目一个
这些文件映射中包含如下行:
这将是从一体式 Mercurial 存储库中提取项目二的存储库时使用的文件映射。您可能需要列出这些映射中的每个单独文件,但我认为目录是可以的。
这里还有另一个问题,我回答了几乎相同的问题,并粘贴了一个完整的示例,但这应该足以让你继续下去。
This is easily done using the 'convert' extension as you've suggested. Here's the procedure:
hg convert SVNREPO all-in-one-mercurial-repo
from svn to mercurial with everythinghg convert --filemap projectfilemap.txt all-in-one-mercurial-repo project-repo
commands -- one per projectThose filemaps have in them lines like:
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.