Optimal Merge Base selection

Martin Pool mbp at sourcefrog.net
Wed Jul 13 07:44:55 BST 2005


On 12 Jul 2005, John A Meinel <john at arbash-meinel.com> wrote:

> > % weave merge test.weave 4 5
> > aaa
> > bbb
> > <<<<<<<< version 4
> > stuff from martin
> > fix up merge
> > modify john's code
> > ccc
> > ddd
> > add stuff here
> > ========
> > stuff from john
> > more john stuff
> > john replaced ccc line
> >
> >>>>>>>>>version 5

To make this easier to read: we are trying to merge these two versions:

% weave inclusions test.weave  4
0 1 2 3 4
% weave annotate test.weave 4
    0 | aaa
      | bbb
    1 | stuff from martin
    3 | fix up merge
    4 | modify john's code
    0 | ccc
    1 | ddd
    4 | add stuff here

% weave inclusions test.weave  5
0 2 5
% weave annotate test.weave 5
    0 | aaa
      | bbb
    2 | stuff from john
      | more john stuff
    5 | john replaced ccc line

The proximate cause of the problem is that the merge command tries to
find conflict regions by aligning on sections unchanged in the composite
base and both sides.  Here this is only aaa,bbb, and so the rest of the
file conflicts.   But hopefully we can do better.

Another approach is already available through the 'mash' command, which
turns on the union of inclusion/deletion instructions for both
versions.  This gives

% weave mash test.weave 4 5
aaa
bbb
stuff from martin
fix up merge
modify john's code
john replaced ccc line

This seems like a rather more plausible reconciliation of the changes
that were made on either side.

The main drawback of this is that I don't yet have anything that will
distinguish possibly-conflicted regions needing user attention.  Perhaps
it can be done though.


-- 
Martin




More information about the bazaar mailing list