CommitDatabaseHelper¶
- class dsviper.CommitDatabaseHelper¶
Bases:
objectNavigates the commit DAG.
reduce_heads(commit_database [, commit_id]) reduces multiple heads into one, the head commit_id names or the last commit by default; forward and fast_forward move along the DAG. Stateless, like CommitStateBuilder.
Note: Not directly instantiable.
- static fast_forward(commit_database: CommitDatabase, commit_id: ValueCommitId) ValueCommitId¶
Return the head commit_database reaches from commit_id by following its single child at each step.
- static forward(commit_database: CommitDatabase, commit_id: ValueCommitId) ValueCommitId¶
Return the head of commit_database when there is only one, and otherwise what fast_forward(commit_id) reaches.
- static reduce_heads(commit_database: CommitDatabase, commit_id: ValueCommitId | None = None) ValueCommitId | None¶
Reduce commit_database to a single head, and return the new commit_id.
The other heads are reduced one at a time into the anchor commit_id, which must itself be a head and defaults to last_commit_id. Returns None when there was nothing to reduce.
On a path both heads wrote, the later in linearisation order wins and the other is dropped; nothing is signalled. CommitMergeAnalyzer reconstructs, after the fact, what a merge did not keep.