ThreeWayMerger

com.phasmidsoftware.xmldoc.idml.ThreeWayMerger

The real, end-to-end 3-way merge, combining Merger's attribute-level reconciliation with PcsMerger's structural one - each catches conflicts, and resolves edits, that the other cannot:

  • Merger decides a matched node's own tag/attributes, attribute by attribute - so two sides changing different attributes of the same node (the running HelloWorld2A/HelloWorld2B example, MergerSpec) combine cleanly. It has no notion of position at all, so it is blind to reordering and reparenting.
  • PcsMerger decides a node's position and parent - so a plain reorder or a Kaining 10-group-ungroup reparenting conflict, both invisible to Merger, are handled correctly (PcsMergerSpec). Its own Content relation, though, only ever sees a node's whole tag+attributes as one indivisible blob - by itself, it would (wrongly) report the HelloWorld2A/HelloWorld2B case above as a conflict, since it can't tell "different attributes changed" from "the same attribute changed differently".

This reconciles the two: structure (which nodes exist, in what order, under what parent) comes entirely from PcsMerger/PcsTreeBuilder; a matched node's own tag/attributes come from Merger wherever Merger has an opinion (i.e. the node has a Self) - PcsMerger's own (coarser) content resolution only fills in the rest: Self-less nodes (Properties, the PathGeometry chain, ...), which Merger never sees at all.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def merge(base: GenericElement, left: GenericElement, right: GenericElement, ignoredAttributes: Set[String] = ...): Either[Seq[StructuralConflict], GenericElement]

Merges left and right, both relative to base.

Merges left and right, both relative to base.

Value parameters

base

the common ancestor.

ignoredAttributes

forwarded to both Merger.merge and PcsMerger.merge - see EditDetector.defaultIgnoredAttributes. Passed to both, not just one, since a node whose only difference is an ignored attribute needs to look unchanged from both mergers' point of view - otherwise the one that still sees a difference reports a conflict ThreeWayMerger's own dedup logic (below) can't catch, since the other merger never had any opinion on that node at all to defer to.

left

one independently modified version.

right

the other independently modified version.

Attributes

Returns

Right the merged tree, or Left every conflict found (attribute-level and structural together, in one uniform shape) if there was at least one.