Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Join two Mercurial repositories into one line of revisions

Tags:

mercurial

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.

like image 969
Deleted Avatar asked May 02 '11 15:05

Deleted


1 Answers

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

like image 85
Ringding Avatar answered Oct 03 '22 19:10

Ringding