Merge two repositories of mmo.client's kanban entities (KanbanBoard, KanbanTicket, KanbanComment) into each other, when asked: a local one -- a JsonRepository, mmo.mongodb's MongoRepository -- where the tickets are worked on, and a remote one, usually a GitHubRepository (a GitHub project, or a repository's issues). Each side keeps its own ids; a sync writes on each side what the other changed since the last one.
class MMO\git\helpers\BoardSync
Espace de noms
MMO\git\helpers
Voir
$match (the same title, by default) before any is made. - A ticket removed on one side is removed on the other, unless the other changed it since (a conflict), or, $deletions is false. A remote ticket missing from what GitHub lists is not taken for removed on that alone: GitHub lists a draft just made minutes later. It is removed once GitHub confirms it is gone, asked for it by what finds it without the listing (a project item's node id, kept in the state while it was listed: GitHubRepository::isGone), and never while it is younger than $grace when a sync made it; until then the pair is kept and the report says so (unconfirmed), nothing is written on either side. - The statuses are paired by $statuses, else by their label, else by their id, else by their type; the categories and the labels by their label. A parent, or a ticket a constraint names, is the paired ticket. - The comments are merged the same way, ticket by ticket, when the remote ticket has a discussion. A project's draft has none: one whose local ticket has comments becomes an issue first ($issues), else its comments stay local. A comment made on GitHub says who wrote it locally when it is not the token's owner; only the token's owner's comments are changed or removed there. - What one side cannot keep (a draft's labels) is not a change: the remote side is read again after it is written, and what it kept is what the next sync compares with -- a draft GitHub does not list yet is what it holds of what was written (ProjectBoard::save: no labels), not what was written. The local ticket keeps its labels.
### How it merges
It is a three-way merge: [`$state`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/BoardSync.md#boardsync-state) keeps, for each pair of tickets (a local id, a remote id), what both sides held
at the end of the last sync, field by field. A field changed on one side only is written on the other; changed on
both to different values, it is a conflict, settled by [`$conflicts`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/BoardSync.md#boardsync-conflicts) (left as it is on both sides by default, and
reported until one side is changed to match the other).
- A ticket on one side only is made on the other. The first time, the tickets of both sides are paired by
Nothing is written on a dry run: the report says what would be.
A sync as the configuration's kanbanSync describes it: each profile names the repositories of the configuration (local, remote), the board, the remoteBoard, the state file, and `conflic…
Write on each local ticket what its remote one is called and where it is (KanbanTicket's ref and url, which are not merged): gh#255, for a person holding GitHub's number to find the local tic…
$stateFile; made: when a sync made the remote ticket of a pair, by local id (for $grace); locators: what finds a pair's remote ticket on GitHub without listing the board (GitHubRepository::locator), by local id
string, remote: string, ref: ?string, title: string, status: ?string, side: string}> the pairs it names: side says which side's id it is (both sides may have a ticket of that number)
A sync as the configuration's kanbanSync describes it: each profile names the repositories of the configuration (local, remote), the board, the remoteBoard, the state file, and conflicts, deletions, issues, statuses, matchId, grace (the properties of the same names).
static function FromProfile(?string $profile, array $options = []): static
Make an issue of each remote draft whose local ticket has comments: a draft has no discussion. The pair names the issue then; what the draft could not keep (its labels) is written from the local ticket, and so are the remote tickets naming the draft (a parent, a constraint).
Write on each local ticket what its remote one is called and where it is (KanbanTicket's ref and url, which are not merged): gh#255, for a person holding GitHub's number to find the local ticket on the board (its filter) or by find. A local ticket paired no more loses them. Only a remote side naming its tickets (remoteRef) does it.
{dryRun, local, remote, conflicts, unconfirmed, notes}: what was done on each side (created, updated, removed tickets, comments, and the drafts made issues), the conflicts left, the pairs whose remote ticket GitHub's listing left out without GitHub confirming it is gone (kept, not removed: {ticket, remote, title, message}), and what could not be synced
lève
when a side refuses a change: what was done before is kept in the state
why it may be there still, and its local ticket is not to be removed (nor it made again); null: it is gone indeed -- a remote side other than GitHub lists what it holds
Write the refs of the last sync's pairs on the local tickets (refs), without syncing: GitHub is read, not written. What a sync does at its end; for a board synced before the refs were written.
a JSON file keeping what both sides held at the end of the last sync ({root} and the like are expanded): the pairs of tickets and comments, and their fields. Lost, the next sync pairs the tickets by $match again, and settles every difference as a conflict.