pub fn apply(
op_log: &OpLog,
head_op: Option<&OpId>,
op: Operation,
transition: StageTransition,
) -> Result<NewHead, ApplyError>Expand description
Apply an operation against a branch head and persist it.
Validates parents:
- If
op.parents.is_empty():head_opmust beNone(genesis op on an empty branch). - If
op.parents.len() == 1: that parent must equalhead_op. - If
op.parents.len() == 2: one parent must equalhead_op, and the other must already exist in the log (a merge op’s second-parent ancestry must be reachable). - All other arities are rejected as
StaleParent.