How to merge two history-seperated repositories into one?

There are two repositories with the changesets like the following:

[REPO_A]    1.0 - 1.1 - ... - 1.27 - 1.28
[REPO_B]    1.0 - 1.1 - ... - 1.14 - 1.15

The changeset 1.0 in repo B contains the same files of the changeset 1.28 in repo A. I want to merge the two repositories into one with the linked changesets:

[REPO_C]    1.0 - 1.1 -1.2 - ... - 1.28 - 1.1' - 1.2' - ... - 1.15'

However, I don’t know whether there is any command or tool to do so in BitKeeper


Like you wanted to put the Linux kernel history back together. :wink:

You can do it, but I don’t think we have a tool for that. Just off of the top of my head, this is what I would do:

  1. Convert everything to ASCII format

  2. The ChangeSet file graph is failure easy to concatenate together and just update the parent point of 1.1’ to point at 1.28

  3. The ChangeSet file weave is a very simple table and these can be concatenated with the newer commits on top and renumbered.

  4. the graphs of the individual files are like the ChangeSet file and can be done.

  5. The file weaves are where it gets interesting, Here you need to properly interleave the diffs between the two files. Oh! wait we do have a tool that does this, it is called takepatch and is how ‘bk pull’ works.


You want to create a patch in B from 1.1 to the TIP and then edit the patch to change all the rootkeys and 1.1 keys to match the corresponding keys in A. Recreate the patch checksums. Then use takepatch to apply it.

So it can be done, but I don’t think we have a command for it. And it would take most of us a while to figure out.