Diff3
Diff3[ancestor,first,second]
attempts to resolve two different sets of edits from a common ancestor.
Diff3[ancestor,first,second,format]
represents the diffs in the indicated format.
Details and Options
![](Files/Diff3.en/details_1.png)
![](Files/Diff3.en/details_2.png)
- Diff3 produces results for the following types of expressions:
-
lists {…} returns differences between two lists text "text", File["fname.txt"] returns differences in individual characters, words or lines between two blocks of text biomolecular sequences BioSequence[…] returns differences in letter strings between two biomolecular sequences cells Cell[…], CellObject[…] returns differences in content, styles and options between two cells notebooks Notebook[…], NotebookObject[…], File["fname.nb"] returns differences in cells and options between two notebooks - Diff3 returns a DiffObject.
- Diff3 uses a variant of SequenceAlignment that allows alignment of three lists or strings.
- Diff3 takes all the same options as Diff.
- If the diffs between ancestor and each of the edits can be applied in sequence to produce a combined result, then using DiffApply on the resulting DiffObject will apply both sets of changes. Otherwise, the DiffObject will include conflict markers and be unusable by DiffApply.
- Diff3[ancestor,first,second] is equivalent to Diff3[ancestor,first,second,"DiffObjectViewer"], which produces a viewer with a popup menu allowing you to interactively select between different formats. Other values of format display as the given format, without the ability to interactively change the view type.
- Some values of format use abstract visualizations to depict the nature and extent of the changes among ancestor, first and second:
-
"ArrayPlot" display a merged list of elements in an array plot, with colored array cells annotating the changes "SideBySideSummary" display ancestor, first and second as separate sequences of colored array cells with long, unchanged sequences elided "UnifiedSummary" display ancestor, first and second as a combined sequence of colored array cells with long, unchanged sequences elided - Other acceptable values of format include:
-
"Details" produce a textual description of each change "DiffObjectViewer" display in a panel with an interactive format setting "SideBySide" display elements of ancestor, first and second in aligned, side-by-side columns "SummaryBox" display as a DiffObject summary box - Some values of format will only work with a subset of expression types.
- Diff3[ancestor,edit1,edit2][format] is equivalent to Diff3[ancestor,edit1,edit2,format].
Examples
open allclose allBasic Examples (2)
Wolfram Research (2024), Diff3, Wolfram Language function, https://reference.wolfram.com/language/ref/Diff3.html.
Text
Wolfram Research (2024), Diff3, Wolfram Language function, https://reference.wolfram.com/language/ref/Diff3.html.
CMS
Wolfram Language. 2024. "Diff3." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Diff3.html.
APA
Wolfram Language. (2024). Diff3. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Diff3.html