Now that we have moved into an XML syntax world, we have the opportunity for a richer representation to show non-conflicting changes. It is often useful to see these to understand how a merge has been handled and provides more context when resolving conflicts. In this example we could show the origin of the '4 5' data that was added by A.
To show this we need to have elements defined for the limited combinations of the
three input files. We can do this as <ao>
for data in both O and A, and similarly
<ab>
, <ob>
. We do not need <aob>
because any lines matched across all three
will be present as a child of the root element. Any non-conflicting change will have
one of these dual origin elements as one of the two options. As these are
non-conflicting changes, they are a resolved choice and we can indicate this with an
attribute to show which option has been included. This attribute could also be used
to indicate which option or options in a conflicting choice is to be included in the
final result. A GUI might provide a user with the ability to undo this
choice.
<diff3x a="A.txt" b="B.txt" o="O.txt">1<choice2><a include="true"> 4 5</a><ob/></choice2> 2<choice3><a> 3</a><o> 3 4 5</o><b> 4 5 3</b></choice3> 6</diff3x>