如何在不使用子存储库的情况下将商业存储库(包括历史记录)作为子目录导入另一个商业存储库? [英] How can I import a mercurial repo (including history) into another mercurial repo as a subdirectory, without using subrepos?

查看:70
本文介绍了如何在不使用子存储库的情况下将商业存储库(包括历史记录)作为子目录导入另一个商业存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来很复杂,所以让我解释一下:

This sounds kind of complex, so let me explain:

Project_A已在其自己的Mercurial存储库中居住了一段时间. Project_A现在被折叠到一个新的超级项目Super-Project_B中. Super-Project_B也有一个辅助库.如果Project_A不是子仓库,而是一个普通的孩子,我们会更愿意,但是我们也不想失去历史.有办法吗?

Project_A has lived for some time within its own Mercurial repository. Project_A is now getting folded into a new super project, Super-Project_B. Super-Project_B also has a mercurial repository. We would prefer if Project_A were not a subrepo, but instead just a normal child, but we also don't want to lose the history. Is there a way to do this?

推荐答案

是的.使用convert扩展名将projectA向下移动到一个目录级别:

Yeah. Use the convert extension to move projectA down one directory level:

hg convert --filemap filemap.txt projectA projectA-redone

您的filemap.txt其中包含以下行:

rename . projectA

(该点可能是斜杠,但我不这么认为).

(that dot might be a slash but I don't think so).

这将为您提供一个新的回购,即projectA-redone,它具有A的全部历史记录,尽管所有变更集的散列都将有所不同,因为它们的内容(路径)已更改为使"projectA"位于所有变更集的前面.

That will give you a new repo, projectA-redone, that has all the history of A though all the changesets will have different hashes since their content (paths) have changed to get "projectA" in front of all of them.

然后进入Super-Project_B并执行hg pull -f /path/to/projectA-redone.您需要-f,因为否则它们将被告知存储库无关,因为它们没有相同的变更集.

Then you go into Super-Project_B and do a hg pull -f /path/to/projectA-redone. You need the -f because otherwise you'll be told that the repos are unrelated since they have no changesets in common.

最后,您将在Super_project_b中执行一个不冲突的hg merge(除非您已经有一个projectA目录,在这种情况下,您应该选择一个不同的名称或首先hg remove将其命名).

Finally you'll do a hg merge in Super_project_b which should have no conflicts (unless you already had a projectA directory, in which case you should've picked a different name or hg removed it first).

这样做之后,B将在项目A子目录中包含所有A,并且所有历史记录都将保持不变.

After doing that B will have all of A inside the projectA subdirectory and all history will be intact.

这篇关于如何在不使用子存储库的情况下将商业存储库(包括历史记录)作为子目录导入另一个商业存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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