将更改从一个Mercurial存储库添加到另一个 [英] Adding changes from one Mercurial repository to another

查看:100
本文介绍了将更改从一个Mercurial存储库添加到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,将我的项目 FakeItEasy 的VCS从SVN更改为Mercurial时,我是有点太渴望了(我很有趣).我所做的只是从SVN中签出最新版本,然后将该签出作为新Mercurial回购的第一版.显然,这会丢失所有历史记录.

When changing the VCS for my project FakeItEasy from SVN to Mercurial on Google Code I was a bit too eager (I'm funny like that). What I did was just checking the latest version out of SVN and then commiting that checkout as the first revision of the new Mercurial repo. This obviously has the effect that all history is lost.

后来习惯了Mercurial时变得更好了一点,我意识到有一种转换扩展名"之类的东西,它使您可以将SVN存储库转换为Mercurial存储库.现在,我要做的是转换旧的SVN存储库,然后将当前存在的Mercurial存储库中的所有更改集导入到此转换后的存储库中.是对Mercurial的首次提交.

Later when getting a bit better acustomed to Mercurial I realized that there is such a thing as a "convert extension" that allows you to convert a SVN repo into a Mercurial repo. Now what I want to do is to convert the old SVN repo and then have all change sets from the currently existing Mercurial repo imported into this converted repo except the very first commit to Mercurial.

我已经将SVN存储库转换为本地Mercurial存储库,但是现在是我被困的时候.我以为我可以使用convert扩展将当前的Mercurial存储库带到转换后的存储库中,并通过一个拼接图删除第一个提交,但我似乎无法使其正常工作.

I've converted the SVN repo to a local Mercurial repo but now is when I'm stuck. I thought I'd be able to use the convert extension to bring the current Mercurial repository into the converted one and having a splice map remove the first commit but I can not seem to get this to work.

我也尝试过使用无拼接映射的转换,将所有更改集从当前的Mercurial存储库转换为转换后的版本,并将当前版本中的第二个版本重新设置为旧SVN存储库中的最后一个提交,但是我可以也不能使它正常工作.

I've also tried to just use convert without splice map to get all change sets from the current Mercurial repo into the converted one and the rebase the second version in the current to the last commit from the old SVN repository but I can't get that to work either.

为了更加清楚,可以说我有以下两个存储库:

To make this clearer lets say I have these two repositories:

A: revA1-revA2
B: revB1-revB2-revB3 (Where revB1 is actually a copy of revA2)

现在,我想将两者结合到包含以下内容的新存储库中:

Now I want to combine these two into the new repository containing this:

C: revA1-revA2-revB2-revB3

推荐答案

只要要更改新修订的哈希值,就可以使用exportimport(或transplant命令,这是围绕这两个命令的包装).

So long as you're changing the hashes on the new revisions (you are), you might as well just use export and import (or the transplant command that is a wrapper around the two).

您已经进行了转换,这很棒,现在进入存储库B并执行:

You already did your convert, which is great, now go into repo B and do:

hg export -o 'changeset-%R.patch' 1:tip

将为版本B中的每个变更集创建一个变更集-##.patch,但第一个(编号为零)除外.

that will create a changeset-##.patch for each changeset in repo B, except the first (numbered zero).

现在转到仓库C并将其导入:

Now go to repo C and import them:

hg import $(ls *.patch | sort -V)

如果确实revA2和revB1是相同的,那么所有这些都应该完全适用.

That should all apply cleanly if indeed the revA2 and revB1 were identical.

这篇关于将更改从一个Mercurial存储库添加到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆