[MERGE REQUEST] merge work

John A Meinel john at arbash-meinel.com
Wed Aug 17 15:46:03 BST 2005


Erik Bågfors wrote:
>>I think the next thing to do is better tracking of merged-in revisions.
>>The steps would seem to be:
>>
>> - when merging, make sure the destination branch includes the revision
>>   and inventory objects for everything merged in (and everything
>>   indirectly merged)
>>
>> - add the tip of the merged branch to pending-merges
>>
>>What do you think?
>>
>>Ideally then
>>
>> - bzr status should show a brief representation of the pending merges
>>
>> - bzr log should show them indented
>>
>> - bzr merge can use them to find a good basis
>>
> 
> 
> Oh, this would be so great!
> 
> What about pulling after merging.  What I mean is this

Short answer: it should work. :)

The official statement is that you can pull a revision if the current
revision is in the parents of the revision being pulled.

In your case:


Branch1 (parent)
	A	None
	B	A
	C1	B
	D1	C1
	C2D2Merge D1,D2

At this point Branch2 has:
	A	None
	B	A
	C2	B
	D2	C2

Now, if Branch2 just did "cd branch2; bzr pull ../branch1" it should
work. Because D2 is one of the parents of C2D2Merge in fact, it should
just look like this:
	A	None
	B	A
	C2	B
	D2	C2
	C2D2Merge D1,D2

(Notice that it is the exact revision name).
You shouldn't have to merge anything back.
Now, what we really want is something like this:

Branch1: A, B, C1, D1, C2D2Merge, E1, F1
Branch2: A, B, C2, D2

cd Branch2; bzr pull ../Branch1
Branch2: A, B, C2, D2, C2D2Merge, E1, F1

Now, what has been discussed, is that if you try to "bzr pull" should it
do a "bzr merge" if the ancestry is different. And if you do "bzr merge"
but it can do it like a pull, should it?

In my head, "bzr pull" changes the revision-history file, while "bzr
merge" does not. (Ie pull adds new commits, merge just updates the
working tree and tracks some meta-data).

> 
> Say that we have two branches, they both have commits A and B, then
> both users have two more commits, C1, D1 and C2, D2.  Now the first
> branch merges from the second and will now have
> 
> A, B, C1, D1, C2D2Merge
> 
> In the second branch the user can now do a merge as well and get
> 
> A, B, C2, D2, C1D1Merge
> 
> At this point, the two branches are the same and I think you should be
> able to do "bzr pull" from the other branch for any future updates
> (until we need to do a merge again that is).

Unfortunately, if Branch2 merges from branch1, *and* branch1 merges from
branch2 it will require another merge to get them to be pullable. Why?
Because the new merge revision is not a local parent, and thus needs to
be merged normally.

> 
> I know this means that the two branches will not share the same
> history but they are branches and as such should not have the same
> history in my mind.

There is no problem here, because a revision can have multiple parents,
effectively meaning it contains all of that history too.

John
=:->

> 
> Regards,
> Erik
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050817/df2a0df2/attachment.pgp 


More information about the bazaar mailing list