gpt4 book ai didi

svn - 当主干/分支/标签结构一团糟时,如何从 Subversion 迁移到 Mercurial?

转载 作者:太空狗 更新时间:2023-10-29 12:59:31 25 4
gpt4 key购买 nike

我想将存储库从 Subversion 转换为 Mercurial,但是当我最初设置存储库时,我尽可能地以最懒惰的方式进行。随着时间的推移,结构继续变形和恶化(此时它已经 5 岁了)。不过,我想保留尽可能多的历史记录,即使我不得不弄脏并手动将东西缝合在一起。

事不宜迟,当前结构如下所示:

svn://svn.example.com/Example
+ trunk
+ BigProject
+ BinaryDepedencies
+ branches
+ BigProject
+ branch1
+ feature1
+ maintenance1
+ ...
+ tags
+ BigProject
+ tag1
+ tag2
+ ...
+ projects
+ small_project1
+ small_project2
+ small_project3
+ ...

鉴于这只是最近的结构,这个存储库还有希望吗?如果没有希望,任何人都有在 Mercurial(或集市)中手动重建历史的好方法。

另外,出于各种原因,除非有一个防弹策略将这个特定的 repo 从 Subversion 转换到 git 再到 hg/bzr,否则我将无法使用 git。

最佳答案

一个策略可能是转换主干。如果您的后备箱移动了,您可能需要玩一些游戏,但应该不会太难。

您的武器库中的另一个工具可能是 hg->hg 转换和 rebase 扩展。在 hg 存储库中有东西之后,你可以使用它们来摆弄你的树,并在你转换它们之后移植到 Twig 上。或者在移动后移植新的树干历史。

这里是关于 Mercurial rebase extension 的文档的一个很好的链接.

基本上,这是您要遵循的策略...首先,使用 convert extensionhgsvn转换部分存储库。这可能会导致出现多条主干线,或出现在与主线不同的存储库中的分支。

如果您在不同的存储库中有两个主干部分,并且 second 目录中的一个紧跟在 first 目录中的那个之后,您可以这样做:

cd second
hg log -r 0
# Note the revision hash
cd ../first
hg tip
# Again, note the revision hash
hg pull -f ../second
hg rebase --source <revision hash from hg log -r 0> --dest <revision hash from hg tip>

这会将躯干的一部分移植到躯干的另一部分上。

如果您在单独的存储库中有一个分支,则该过程会稍微复杂一些:

cd branch
hg log -r 0
# Note the revision hash
cd ../trunk
# Find the revision that the branch branches off from and note its hash.
# We will call this revision the 'branch base'.
hg pull -f ../branch
hg rebase --source <revision hash from hg log -r 0> --dest <revision hash of branch base>

这会将分支嫁接到主树上。

关于svn - 当主干/分支/标签结构一团糟时,如何从 Subversion 迁移到 Mercurial?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2103242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com