IdmlMergeDriver

com.phasmidsoftware.xmldoc.idml.IdmlMergeDriver

A real, runnable git merge driver for .idml files (see MERGE.md's "Eventual integration: a git merge driver"): merge(base, ours, theirs) mutates ours in place - exactly git's own %O %A %B contract, ours being the file to leave in whatever state should actually be used.

Every part IdmlPackage.parts lists (Spreads, Stories, MasterSpreads, Resources, ...) goes through IdmlPackageMerger, each part a normal ThreeWayMerger.merge. designmap.xml itself is handled separately and much more narrowly: it's a far richer element than "a list of part references" (its own Self, plenty of other Self-bearing children like Language resource definitions, and - confirmed by direct inspection - a leading processing instruction that `scala.xml`'s parser silently drops and `GenericElement` has no way to put back). A full 3-way merge of all of that is out of scope here; instead, `ours`'s own `designmap.xml` is left completely untouched *unless* a part was actually added or removed, in which case its exact text is surgically patched - one line inserted or removed - rather than parsed and rebuilt, so everything else about it (including that processing instruction) survives byte for byte.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def main(args: Array[String]): Unit

The git merge driver contract: %O %A %B as three file paths. Exit 0 (and ours/%A now holds the merge result) on success; exit 1, ours untouched, on conflict; exit 2 on any other failure (bad arguments, unreadable/corrupt files).

The git merge driver contract: %O %A %B as three file paths. Exit 0 (and ours/%A now holds the merge result) on success; exit 1, ours untouched, on conflict; exit 2 on any other failure (bad arguments, unreadable/corrupt files).

Attributes

def merge(base: File, ours: File, theirs: File, ignoredAttributes: Set[String] = ...): Try[Seq[PartConflict]]

Merges theirs into ours, both relative to base, mutating ours in place on success.

Merges theirs into ours, both relative to base, mutating ours in place on success.

Value parameters

base

the common ancestor .idml file.

ignoredAttributes

forwarded to IdmlPackageMerger.merge - see EditDetector.defaultIgnoredAttributes.

ours

"our" independently modified version - mutated in place if the merge succeeds; left untouched if it doesn't.

theirs

the other independently modified version.

Attributes

Returns

every part-level conflict found (empty means ours was updated and the merge succeeded), or a Failure if the files themselves couldn't be read/written.