DiffObject

DiffObject[v, type, data]

represents a sequence of diffs for transforming objects of the indicated type.

Details

  • DiffObject can be generated by Diff and Diff3.
  • Recognized types include "Elements", "Characters", "Words", "Lines", "Cells" and "Notebooks".
  • Types for three-way comparisons are {"Elements", 3}, {"Characters", 3}, etc.
  • The data argument is an Association that contains detailed information about the diffs and metadata about the comparison that generated them.
  • When displayed, a typical DiffObject will show a representation of the diffs and an interface to explore them.
  • If obj is a DiffObject, then obj[prop] will return the value of the requested property, and obj[{prop1, prop2, }] will return an association of the requested property values.
  • Available properties include:
  • "Properties"list of avaialble property names
    "Type"the type
    "Changes"the raw change data
    "Matches"changes that represent matching elements
    "Insertions"changes that represent insertions
    "Deletions"changes that represent deletions
    "Edits"changes that represent edited elements
    "Conflicts"changes that conflict
    "SummaryString"a brief summary of the changes
    "LabeledChanges"labeled changes
    "MetadataInfo"additional information
    "DefaultFormat"the name of the default format for this object
    "Formats"a list of formats supprted for this object
  • If obj is a DiffObject that supports the format fmt, then obj[fmt] will display it.

Examples

open allclose all

Basic Examples  (2)

Diff generates a DiffObject:

Extract information about diffs from a DiffObject:

Get a summary of a DiffObject:

If Diff3 finds a conflict, that will be reflected in the DiffObject:

Individual changes representing a conflict can be extracted from a DiffObject:

Scope  (2)

The list of available formats can change from one DiffObject to another:

Return a variety of data and formatting for a given DiffObject:

Properties & Relations  (1)

DiffApply applies a DiffObject to an expression:

Possible Issues  (1)

If a DiffObject has a version number or a structure that is not recognized by your current paclet, its formatting will reflect that:

Wolfram Research (2024), DiffObject, Wolfram Language function, https://reference.wolfram.com/language/ref/DiffObject.html.

Text

Wolfram Research (2024), DiffObject, Wolfram Language function, https://reference.wolfram.com/language/ref/DiffObject.html.

CMS

Wolfram Language. 2024. "DiffObject." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DiffObject.html.

APA

Wolfram Language. (2024). DiffObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiffObject.html

BibTeX

@misc{reference.wolfram_2024_diffobject, author="Wolfram Research", title="{DiffObject}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/DiffObject.html}", note=[Accessed: 16-September-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_diffobject, organization={Wolfram Research}, title={DiffObject}, year={2024}, url={https://reference.wolfram.com/language/ref/DiffObject.html}, note=[Accessed: 16-September-2024 ]}