How can I merge three branches which have no common ancestors ?

John Arbash Meinel john at arbash-meinel.com
Tue Jan 24 15:00:17 GMT 2006


Vincent LADEUIL wrote:
> Hi,
> 
> I'm currently migrating from CVS to bzr.
> 
> Under CVS I had 3 modules hence the following dirs (files omitted
> for clarity, they  only exist inside the dirs,  none are directly
> under cvs-working-dir) :
> 
> cvs-working-dir/bin
> cvs-working-dir/bin/CVS
> cvs-working-dir/lib
> cvs-working-dir/lib/CVS
> cvs-working-dir/projet
> cvs-working-dir/projet/CVS
> 
> Using 'tailor'  I was  able to create  three bzr  branches (again
> files have  been omitted to  clarity and still exist  only inside
> dirs, none are directly under tailor-wd):
> 
> tailor-wd/bin
> tailor-wd/bin/.bzr
> tailor-wd/lib
> tailor-wd/lib/.bzr
> tailor-wd/projet
> tailor-wd/projet/.bzr
> 
> 
> Now I want :
> 
> bzr-wd/.bzr
> bzr-wd/bin
> bzr-wd/lib
> bzr-wd/projet
> 
> I tried  various combinations of  init/pull/move/merge but didn't
> find  a  solution.  Each  time  I  try  to  "import"  the  second
> directory,  the first  one  get  erased by  the  merge (the  pull
> refuses to "add" to my branch).
> 
> Any advice ?
> 
> Should I just forget about keeping my history of modifications ?
> 
> Thanks in advance,
> 
>        Vincent

The easiest thing to do is to start with one project, merge in the
others, and move the files around so that things are clean.

$ bzr get $bin bzr-wd
$ bzr mkdir bin

Move all the files into bin
this is an approximate of what you would do
Probably you need to move most files individualy.

$ bzr mv * bin
$ bzr commit -m "Moving bin files into bin"

# Now merge the another project into this one.
$ bzr merge -r 0..-1 $lib

The 0..-1 says merge all of the revisions in lib,
even if there is no common ancestor
all the files end up in . so move them out of the way

$ bzr mkdir lib
# Remember, don't move 'bin' into lib
$ bzr mv * lib
$ bzr commit -m "Merging lib into project"

Repeat for the 'projet' branch.

Now you should have a new branch, which contains the ancestry of all 3
projects, and the texts are now in subdirectories.

In the future we might support doing this a little bit more cleanly,
such as with a 'bzr merge --into=lib -r0..-1 ../lib', but this works for
now.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060124/13523c2c/attachment.pgp 


More information about the bazaar mailing list