tags:

views:

223

answers:

2

I use Bazaar and I love it. Generally, I just create different branches and manage them separately. I've just found that all those branches can be put into a repository. If I understand correctly, this should save memory and increase speed as some common ancestor between branches are shared. Q1: Do I understand this right?

Another thing is that when I try to use it I found some problem which I really do not get it. Here is how I attempt.

bzr init-repo --trees TestBzrRepo
cd TestBzrRepo
bzr init trunk
mkdir branches
cd branches

bzr branch ../trunk b01-Add-file2-f
echo 'This is file 2' > file2.f
bzr add file2.f
bzr commit -m "Add file 2"

cd ../../trunk
echo 'This is file 1' > file1.f
bzr add file1.f
bzr commit -m "Add file 1"

cd ../branches/b01-Add-file2-f

From now if I do bzr pull ../../trunk, I got:

bzr: ERROR: These branches have diverged. Use the missing command to see how.
Use the merge command to reconcile them.

If I do bzr merge ../../trunk, I got:

bzr: ERROR: Branches have no common ancestor, and no merge base revision was specified.

bzr conflicts returns nothing and I still cannot pull or merge.

What happen here? and What should I do next. Please help.

Thank you in advance.

+2  A: 

Yes, repositories allow branches to share storage for common history. If you have many branches with related history, this can be a big saving.

Adam Glauser
Thanks for clearify.
NawaMan
+2  A: 

I think the reason for the merge error is that you didn't create a revision before creating your second branch. bzr qlog TestBzrRepo might help to make sense of the situation.

Try bzr merge ../../trunk -r 0..-1.

Adam Glauser
You are right about not having share revision (I simplify the experiment too much). So now I get it to works and I think I understand it better now. However, the suggestion about running merge with revision number does not work.
NawaMan
Command should be `bzr merge ../../trunk -r 0..-1`. Specifying revisions range from 0 (start of the history) and up to the latest revision (-1) will allow you to merge 2 unrelated branches.
bialix
Thanks for the correction bialix. I've fixed the comment.
Adam Glauser