Comment 8 for bug 244115

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 244115] Re: merge between two branches fails

On Tue, 2008-07-01 at 01:21 +0000, John A Meinel wrote:
> I agree that they want the entries in the directory to be "collapsed"
> together. Thinking closely about it, though, if we collapse things into
> the value in OTHER, it is actually better overall.
>
> The reason is that the value then propagates. So if I do:
>
> cd branch1
> bzr merge ../branch2 # I now get branch2's file-id for NAME
> bzr commit -m "resolved some stuff"
>
> cd ../branch2
> bzr merge ../branch1 # No conflicts, because we are using the same file-ids.
>
>
> However if you do the opposite:
>
> cd branch1
> bzr merge ../branch2 # Merge, but keep branch1's file-id for NAME
> bzr commit -m "Include branch2's changes."
>
> cd ../branch2
> bzr merge ../branch1 # Conflict *again*, but again resolve in favor of THIS
> bzr commit -m "bring in branch1"
>
> cd ../branch1
> bzr merge ../branch2 # Conflict *again* ...
>
> I ran into this when working on "annotate". If in doubt, take "OTHER"
> because that "spreads" it to everyone, and eventually everyone agrees.
> If you always resolve in favor of THIS, then everyone always disagrees.

Choosing OTHER is no better - simple cris-cross merges at this point will cause both sides to switch ids.

If we need want to force pseudo-joining (a bad idea today I feel, even
though I agree that the user /often/ wants to end up with one
directory), then choose something immune to criss-cross.
For instance:
create a new file id by:
new_id = ':'.join(sorted(old_ids))
(this discards both sides of the history, but in a way we could
conceptually recover from)
or
final_id = sorted(old_ids)[0]
(this takes the lexographically lowest id)

-Rob

--
GPG key available at: <http://www.robertcollins.net/keys.txt>.