\Drupal\strata\Branch MergePlan

What a merge would do, object by object, before anything is written.

The document the confirm form prints and the command's manifest. It exists for the same reason a restore plan does: a merge is not one decision but one per configuration object, and a confirmation that said "merge 41 objects" without saying which of them collide is asking somebody to approve something nobody has looked at.

A plan with an unresolved conflict cannot be applied. Not "is discouraged from being applied": MergePlan::isApplicable() is FALSE and Merger refuses. The way past a conflict is to name a strategy, which is a decision with a name attached rather than a default that happened.

A problem is also blocking. The problems are things a branch cannot carry - a change in a realm that is captured as deltas, a merge base that could not be found - and every one of them means the plan does not describe the whole of what the branch holds.

Summary

Methods
Properties
Constants
__construct
refuse
writable
conflicts
unresolved
counts
isApplicable
isEmpty
refusal
summary
jsonSerialize
branch
target
base
ours
theirs
strategy
entries
problems
unchanged
plannedAt
seconds
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$branch

$branch : string

Type

string

$target

$target : string

Type

string

$base

$base : ?string

Type

string|null

$ours

$ours : ?string

Type

string|null

$theirs

$theirs : ?string

Type

string|null

$strategy

$strategy : \Drupal\strata\Branch\MergeStrategy

Type

MergeStrategy

$entries

$entries : array

Type

array<string|int, mixed>

$problems

$problems : array

Type

array<string|int, mixed>

$unchanged

$unchanged : int

Type

int

$plannedAt

$plannedAt : int

Type

int

$seconds

$seconds : float

Type

float

Methods

__construct()

__construct(string  $branch, string  $target, string|null  $base = null, string|null  $ours = null, string|null  $theirs = null, \Drupal\strata\Branch\MergeStrategy  $strategy = \Drupal\strata\Branch\MergeStrategy::REFUSE, array  $entries = [], list  $problems = [], int  $unchanged = 0, int  $plannedAt = 0, float  $seconds = 0.0) : mixed

Constructs a plan.

Parameters

string $branch

Name of the branch being merged in.

string $target

Ref name being merged into, such as heads/main.

string|null $base

The merge base, or NULL when none was found.

string|null $ours

The target's tip, or NULL when the target ref does not exist.

string|null $theirs

The branch's tip, or NULL when the branch does not exist.

\Drupal\strata\Branch\MergeStrategy $strategy

What the plan does with a key both sides changed.

array $entries

Configuration object name keyed to what the merge decided, covering only the objects one side or the other actually touched.

list $problems

One line per thing that stops the merge, each naming what it is about.

int $unchanged

Objects both sides left in the same state, counted rather than listed.

int $plannedAt

Unix microseconds the plan was built.

float $seconds

How long planning took.

Returns

mixed —

refuse()

refuse(string  $branch, string  $target, string  $problem, \Drupal\strata\Branch\MergeStrategy  $strategy = \Drupal\strata\Branch\MergeStrategy::REFUSE) : self

A plan that could not be built.

Parameters

string $branch

Name of the branch.

string $target

Ref name being merged into.

string $problem

Why it could not be built.

\Drupal\strata\Branch\MergeStrategy $strategy

The strategy that was asked for.

Returns

self —

The plan.

writable()

writable() : array<string,\Drupal\strata\Branch\MergeEntry>

The objects the merge would write back to the site.

Returns

array

Object name keyed to its entry.

conflicts()

conflicts() : array<string,\Drupal\strata\Branch\MergeEntry>

The objects both sides changed in the same place.

Returns

array

Object name keyed to its entry, resolved conflicts included.

unresolved()

unresolved() : array<string,\Drupal\strata\Branch\MergeEntry>

The conflicts nothing has decided.

Returns

array

Object name keyed to its entry.

counts()

counts() : array<string,int>

How many objects fall at each outcome.

Returns

array

Outcome value keyed to its count, with every outcome present even at zero so a form can render the full breakdown without inventing rows.

isApplicable()

isApplicable() : bool

Whether the merge can be applied as it stands.

Returns

bool —

TRUE when nothing is blocking and there is at least one object to write.

isEmpty()

isEmpty() : bool

Whether the branch has anything the target does not already hold.

Returns

bool —

TRUE when nothing would be written and nothing is blocking.

refusal()

refusal() : string|null

Why the merge cannot be applied.

Returns

string|null —

One sentence, or NULL when it can.

summary()

summary() : string

A one-line summary for a log entry or a command's output.

Returns

string —

The summary.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The plan as a plain array, which is the form the audit log keeps.