CommitMergeAnalyzer¶
- class dsviper.CommitMergeAnalyzer¶
Bases:
objectAdditive, post-merge 3-way reconciliation over a CommitDatabase. Static methods only; the Commit Engine itself is not modified.
Note: Not directly instantiable.
- static analyze_merge(db: CommitDatabase, merge_commit: ValueCommitId) CommitMergeAnalysis¶
Read the state of merge_commit and return a CommitMergeAnalysis: the loci where one branch’s intent did not survive the merge. 3-way when a unique structural base exists, base-free 2-way fallback otherwise. Raises when merge_commit is not a merge commit.
- static analyze_virtual_merge(db: CommitDatabase, ours: ValueCommitId, theirs: ValueCommitId) CommitMergeAnalysis¶
Pre-merge analysis: the same classification against the computed merge state of (ours, theirs), without persisting a merge commit. The result’s merge_commit() is None (it cannot feed reconcile until materialized).
- static materialize_merge(db: CommitDatabase, ours: ValueCommitId, theirs: ValueCommitId, resolutions: list[CommitMergeResolution], merge_label: str, survival_label: str) tuple[ValueCommitId, ValueCommitId]¶
Pre-merge materialization: write the Merge join of (ours, theirs), then the survival commit against it. Returns (merge_commit, survival); survival == merge_commit when every decree accepts the merge.
- static merge_base(db: CommitDatabase, a: ValueCommitId, b: ValueCommitId) ValueCommitId | None¶
Return the structural merge base of two commits, or None when there is no common ancestor or several maximal common ancestors (criss-cross).
- static reconcile(db: CommitDatabase, merge_commit: ValueCommitId, resolutions: list[CommitMergeResolution], label: str) ValueCommitId¶
Author the survival commit for a merge: per document, copy the merge state, place each decree at its path, then diff against the merge state. Returns a Mutations commit child of merge_commit, or merge_commit itself when every decree accepts the merge (no surviving opcode).
- static reconcile_state(merge_state: CommitState, resolutions: list[CommitMergeResolution]) CommitMutableState¶
Pure compose: per document, copy merge_state, place each decree at its path, diff into a working CommitMutableState. No commit is written; the returned state is what a UI renders and edits live. reconcile is this followed by commit_mutations.