Comparing diff3 format with diff3x

Although human readability is not the prime concern, it is worth looking at how the files might appear. The table below shows the example first used in Table 2, “Mismatched sequences” as diff3 and the corresponding file in diff3x. We have not included the CDATA markers in XML here, but have added an xml:space="preserve" attribute indirectly via the schema.

Table 9. diff3 and diff3x representations

diff3diff3x (XML)
1
4
5
2
<<<<<<< A.txt
3
||||||| O.txt
3
4
5
=======
4
5
3
>>>>>>> B.txt
6
<diff3x a="A.txt" b="B.txt" 
    o="O.txt">1
4
5
2<choice3><a>
3</a><o>
3
4
5</o><b>
4
5
3</b></choice3>
6</diff3x>


It is worth noting that another advantage of the diff3x representation is that choices within a line can be represented quite naturally, so this overcomes the significant limitation of diff3 which is only able to show changes to a complete line.

Table 10. Characteristics of diff3 and diff3x

Characteristicdiff3diff3xComment
No processing needed for unchanged file***** 
Preserve line structure******XML needs CDATA
Good for text editor (by hand)*** 
Intelligent changes***** 
Nested changes**** 
Changes within a line**** 
Show all resolved merges**** 
Show changes to JSON data***** 
Show changes to XML data**** 
Process the changes in the format of the native payload-*Important to note that this is really not possible - a delta format in the native format is needed.


The table does show significant advantages of having an XML representation of diff3 when communicating merge results from a merge driver to a GUI mergetool.