Merges the two versions of a file a site and its copy here both changed (DataSync::BOTH), from the version they last had in common, and shows how they differ -- with mmo.git's diff (Repository::DiffContents).
class MMO\admin\helpers\DataMerge
Namespace
MMO\admin\helpers
- **A JSON collection** -- an object of documents by id, as mmo.core's JsonRepository writes `users.json` or
`pages.json` on one line -- is merged document by document: one side's change is taken, a document both sides
changed differently is a conflict, shown as the diff of the two documents written out.
- **A text** is merged by `git merge-file` ([`Repository::MergeContents`](https://mmoframework.fr/en/documentation/mmo.git/php/helpers/Repository.md#repository-mergecontents)) when the common version is known, each
conflict then shown on its own; without it, every hunk of the diff is one.
- **Anything else** (an SQLite database, an image) is one side or the other, whole.
Each conflict goes to the resolver, which answers [`LOCAL`](https://mmoframework.fr/en/documentation/mmo.admin/php/helpers/DataMerge.md#datamerge-local) or [`TARGET`](https://mmoframework.fr/en/documentation/mmo.admin/php/helpers/DataMerge.md#datamerge-target) -- at a terminal, a person
(`data-merge`), or a rule (`--prefer=`).
Write a collection as the file it came from was written: on one line or pretty, its slashes and its accents escaped or not -- so a merge changes the documents, not the whole file.
Write a collection as the file it came from was written: on one line or pretty, its slashes and its accents escaped or not -- so a merge changes the documents, not the whole file.
static function Encode(array $documents, string $like): string
fn(array $conflict): string -- LOCAL or TARGET for one conflict: its path, its unit (a document's id, hunk 2, file), its kind (document, hunk, file), its diff from the local version to the target's (null for a binary), and both versions of it (null: absent)