Bazaar Version Control System

How to merge a snapshot of branch

Asked by Hiromichi Watari on 2012-02-05

Hi,
I have a snapshot of brach "b" (without any bzr branch info).
How can I merge "b" into branch "a" with a common acesstor (where the two branches split is unkown) ?
Thanks,
Hiromichi

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
2012-02-05
Last reply:
2012-02-06
Martin Pool (mbp) said : #1

On 6 February 2012 03:55, Hiromichi Watari
<email address hidden> wrote:
> New question #186881 on Bazaar:
> https://answers.launchpad.net/bzr/+question/186881
>
> Hi,
> I have a snapshot of brach "b" (without any bzr branch info).

Hi,

So just a source tree with no .bzr information at all?

> How can I merge "b" into branch "a" with a common acesstor (where the two branches split is unkown) ?

If there's no .bzr dir in b then bzr won't directly know what the
common ancestor is supposed to be. There are two main alternatives:

1- Work out which bzr revision this tree corresponds to, and then
merge that. For instance you could write a script that updates a
checkout through various bzr revisions and diffs them to your
snapshot. If it is not exactly the same as any bzr revision this may
be hard to perfectly automate.

2- Do a two-way merge between this tree and the branch a.

If the differences are not very large, #2 is probably what I would do,
using a graphical tool like 'meld'.

--
Martin

Hi Martin,
Thank you for your reply.
Branch "b" is stripped of all .bzr info.
Is it possible to pick a previous revision of branch "a" and use it as a parent and do a 3 way merge of "b" into "a" (using the parent as base) with bzr ?
Thanks,
Hiromichi

Martin Pool (mbp) said : #3

On 7 February 2012 10:01, Hiromichi Watari
<email address hidden> wrote:
> Question #186881 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/186881
>
> Hiromichi Watari posted a new comment:
> Hi Martin,
> Thank you for your reply.
> Branch "b" is stripped of all .bzr info.
> Is it possible to pick a previous revision of branch "a" and use it as a parent and do a 3 way merge of "b" into "a" (using the parent as base) with bzr ?

Hi,

You can't do this directly within bzr but you can extract a patch:

  bzr checkout -r BASE_REVISION a base_tree
  diff -Nur --exclude .bzr base_tree b > b.diff
  cd a
  patch -p0 < ../b.diff

will apply the differences in to a and you can then edit and commit them.

--
Martin

Hi Martin,
Thank you for your input.
What do I have to do if I want to put branch "b" (and all its subdirs) under bzr control anew ?
Thanks,
Hiromichi

Can you help with this problem?

Provide an answer of your own, or ask Hiromichi Watari for more information if necessary.

To post a message you must log in.