将不相关的回购导入 Mercurial 中的另一个回购

Importing unrelated repo into another repo in Mercurial

我有两个 Mercurial 存储库。这两个回购协议都有自己不相关的历史。我们称他们为:

我现在想 "import" Lab 回购到 Main 回购,具有以下限制:

跟随 https://www.mercurial-scm.org/wiki/MergingUnrelatedRepositories 基本有效,但不会创建分支。

给定存储库 MainLab,您可以将 Lab 存储库合并到主存储库并将其默认分支重命名为其他名称,方法是使用 convert 分机:

  1. 创建一个包含 default Lab 的文件 "branchmap.txt"。使用此分支图,"default" 分支中的实验室变更集将被命名为 "Lab"。如果您的实验室存储库中有其他分支,您可能需要其他条目。
  2. 运行hg convert Lab Main --branchmap branchmap.txt。这假定 Lab 和 Main 存储库目录以及 branchmap.txt 文件位于当前目录中。相应地调整路径。实验室变更集将添加到主存储库。
  3. 在主存储库中,以下命令会将 Lab 文件移动到 Lab 子目录中,然后将 Lab 分支与默认分支合并。
    一种。 hg update Lab
    b. mkdir Lab
    C。 hg move * Lab d. hg ci -m "Moved Lab files to Lab subdirectory"
    e. hg update default
    F。 hg merge Lab
    G。 hg ci -m Merge

现在以后可以继续修改Lab分支,按需要合并到default