5

Two "unrelated" Mercurial repositories are created:

user@SERVER ~/mercurialtest
$ cd jointest/

user@SERVER ~/mercurialtest/jointest
$ hg init beginning

user@SERVER ~/mercurialtest/jointest
$ hg init end

user@SERVER ~/mercurialtest/jointest
$ cd beginning/

user@SERVER ~/mercurialtest/jointest/beginning
$ echo "something old..." >> data.txt

user@SERVER ~/mercurialtest/jointest/beginning
$ hg add data.txt

user@SERVER ~/mercurialtest/jointest/beginning
$ hg commit -m "Nr 1 in beginning"

user@SERVER ~/mercurialtest/jointest/beginning
$ echo "something old..." >> data.txt

user@SERVER ~/mercurialtest/jointest/beginning
$ hg commit -m "Nr 2 in beginning"

user@SERVER ~/mercurialtest/jointest/beginning
$ echo "something old..." >> data.txt

user@SERVER ~/mercurialtest/jointest/beginning
$ hg commit -m "Nr 3 in beginning"

user@SERVER ~/mercurialtest/jointest/beginning
$ cp -v data.txt ../end/
`data.txt' -> `../end/data.txt'

user@SERVER ~/mercurialtest/jointest/beginning
$ cd ../end

user@SERVER ~/mercurialtest/jointest/end
$ hg add data.txt # No shared changeset

user@SERVER ~/mercurialtest/jointest/end
$ hg commit -m "Nr 1 in end"

user@SERVER ~/mercurialtest/jointest/end
$ echo "new stuff..." >> data.txt

user@SERVER ~/mercurialtest/jointest/end
$ hg commit -m "Nr 2 in end"

user@SERVER ~/mercurialtest/jointest/end
$ echo "new stuff..." >> data.txt

user@SERVER ~/mercurialtest/jointest/end
$ hg commit -m "Nr 3 in end"

Is it possible and how do I join them together into one repository? I want to go from two separate repositories beginning="o-o-O", end="O-o-o" (with a total of six commits) where they have exactly the same content in O to one repository joined="o-o-O-o-o" (with a total of five commits).

My reason is that I have converted two branches into their own repositories, but I really want them in one instead. I haven´t gotten the convert to work except this way, as separate repositories.

Deleted
  • 4,067
  • 6
  • 33
  • 51
  • 1
    Do you really need to join them hip to hip? Why not head to head? ie. just merge them at the top? The histories would start divergent, but combine at the merge head. Isn't that good enough? – Lasse V. Karlsen May 02 '11 at 20:08
  • And note that in the example script, the first changeset in the `end` repository is not the same as the third changeset in the `beginning` repository. You copy the file over, but you don't commit it, so you commit a changed file. In other words, that first changeset is equivalent to the last changeset of the other repository *+ some stuff*. – Lasse V. Karlsen May 02 '11 at 20:09
  • Lasse: It´s a pretty special occation. I think I need to join them hip to hip. The repos origin is related to do how work using Visual Source Safe was (and should? I dunno) done. Anyway, work will continue in both of these branches in form of bugfixes. – Deleted May 03 '11 at 15:10
  • Lasse: Good catch! :-) I think I fixed it now. – Deleted May 03 '11 at 15:14

1 Answers1

6

The convert extension can do that, using --splicemap.

Ringding
  • 2,856
  • 17
  • 10