Create a new parent branch from two independent existing repositories

Asked by Torsten Andre

Hey,
I have two independent repositories B and C. For both repositories I have a couple of branches B1, B2, ..., Bn and C1, C2, ...Cn, respectively, in which I regularly pull updates from their parent branch (either B or C). Now I have some duplicate code in B and C, which I like to move to another repository, so I can pull files from the common parent repository A to B and C.

I have :
.....B.......C
...//\....,.//\
..B1B2.C1C2

and I would like to have:
...........A
........./...\
.......B.....C
.....//\....,.//\
..B1B2...C1C2
Is there a way to do this and still be able to merge updates from B to Bn, i.e. will Bn still recognize B as a parent branch?

Thanks for your help.

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Jelmer Vernooij
Solved:
Last query:
Last reply:
Revision history for this message
Best Jelmer Vernooij (jelmer) said :
#1

There are two things you can do:

1)
 * You can create a new branch A
 * Add the common files thereto branch A
 * Remove the files from both B and C
 * Forcibly merge A into B and C. (bzr merge -r0..-1 /path/to/A).

2)
 * Create A as a clone of B or C
 * Remove all the non-common files from A
 * Merge A back into B or C (whatever one you originally cloned from), and revert the removal of the non-common files before committing
 * Forcibly merge A into the branch it does derive from (B or C) (bzr merge -r0..-1 /path/to/A)

Revision history for this message
Torsten Andre (tae) said :
#2

Thank you for the very quick answer. I only tried 1) since it already did the trick!

Revision history for this message
Torsten Andre (tae) said :
#3

Thanks Jelmer Vernooij, that solved my question.