Combining repos

Daniel Holth dholth at fastmail.fm
Sat Jun 23 16:17:33 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It is very simple to merge two unrelated repositories but usually one
project must wind up in a subdirectory of the other project.
Otherwise, the files in the root directory, and any other directory
with the same name, would overlap or conflict.

1. Create two unrelated projects.

hg init foo
hg init bar

2. Add files to each project

cd foo
echo "Information about foo" > README
hg add README
hg commit -m "foo commit"
cd ../bar
echo "Information about bar" > README
hg add README
hg commit -m "bar commit"

3. Combine the histories (in bar)
hg pull -f ../foo

/tmp/bar$ hg glog
o  changeset:   1:25ef4112bdbf
   parent:      -1:000000000000

@  changeset:   0:5f3babc82111

4. Move everything from bar/ into a subdirectory so the README does
not collide
mkdir bar
hg mv README bar
hg commit -m "move bar out of the way"

5. Merge
hg merge
hg commit -m "merge foo with bar"
hg glog

@
|\
| o
| |
o |
 /
o

The history has two root revisions.

- - Daniel Holth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGfUecVh4W2pVfoMsRAkiiAKCgguLp6HRDQeWAWT6ssMLZ4AvA9wCglx3d
Y/2SSDw/PbbecLS4KFQug4Y=
=Or+c
-----END PGP SIGNATURE-----




More information about the Mercurial mailing list