Stitch two 'unrelated' repositories together

Arne Babenhauserheide arne_bab at web.de
Thu Jun 18 05:26:11 CDT 2009


Am Donnerstag, 18. Juni 2009 11:48:49 schrieb KrisVH:
> I tried doing it with both merge and rebase, but both detect conflicts
> everywhere, even for files that are completely unchanged between 814 and
> 815 (which is practically all of them). I suppose it's logical, because as
> far as Mercurial is concerned, all files are completely unrelated.

It's logical, because 815 is likely "add new files" and 814 is "minor change 
to files". 

But you could merge 815 and 814 and then merge the rest of the new repo into 
the old one. If the content of 814 and 815 is teh same this should work. 

Here's a script which does that: 

#!/bin/sh

# Test merging two repos where the second starts with a snapshot of the last 
revision of the first.

# preparing the repos and pulling them into a merge repo
hg init one
cd one
echo 1 > 1
hg ci -Am 1
echo 2 > 1
hg ci -m 2
cd ..

hg init two
cd two
cp ../one/1 .
hg ci -Am 2
echo 3 > 1
hg ci -m 3
cd ..

hg init merge
cd merge
hg pull -f ../one
hg pull -f ../two

# updating to the most recent revision in one
hg up 1
# merging the first of two
hg merge 2
hg ci -m "merge base of two into one"
# now merge the rest
hg merge
hg ci -m "merge the rest of two into one"


Please tell me if it works for you! 

Best wishes, 
Arne

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
   - singing a part of the history of free software -
              http://infinite-hands.draketo.de



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://selenic.com/pipermail/mercurial/attachments/20090618/53b538ae/attachment.pgp 


More information about the Mercurial mailing list