Module Commit.History

Build a commit history.

Parameters

module C : Store

Signature

Commit History

type 'a t = 'a C.t

The type for store handles.

type node_key = C.Node.key

The type for node keys.

val node_key_t : node_key Type.t
type commit_key = C.key

The type for commit keys.

val commit_key_t : commit_key Type.t
type v = C.Val.t

The type for commit objects.

val v_t : v Type.t
type info = C.Info.t

The type for commit info.

val info_t : info Type.t
val v : [> Perms.write ] t -> node:node_key -> parents:commit_key list -> info:info -> (commit_key * v) Lwt.t

Create a new commit.

val parents : [> Perms.read ] t -> commit_key -> commit_key list Lwt.t

Get the commit parents.

Commits form a append-only, fully functional, partial-order data-structure: every commit carries the list of its immediate predecessors.

val merge : [> Perms.read_write ] t -> info:(unit -> info) -> commit_key Merge.t

merge t is the 3-way merge function for commit.

val lcas : [> Perms.read ] t -> ?max_depth:int -> ?n:int -> commit_key -> commit_key -> (commit_key list, [ `Max_depth_reached | `Too_many_lcas ]) Stdlib.result Lwt.t

Find the lowest common ancestors lca between two commits.

val lca : [> Perms.read_write ] t -> info:(unit -> info) -> ?max_depth:int -> ?n:int -> commit_key list -> (commit_key option, Merge.conflict) Stdlib.result Lwt.t

Compute the lowest common ancestors ancestor of a list of commits by recursively calling lcas and merging the results.

If one of the merges results in a conflict, or if a call to lcas returns either Error `Max_depth_reached or Error `Too_many_lcas then the function returns the same error.

val three_way_merge : [> Perms.read_write ] t -> info:(unit -> info) -> ?max_depth:int -> ?n:int -> commit_key -> commit_key -> (commit_key, Merge.conflict) Stdlib.result Lwt.t

Compute the lcas of the two commit and 3-way merge the result.

val closure : [> Perms.read ] t -> min:commit_key list -> max:commit_key list -> commit_key list Lwt.t

Same as Node.Graph.closure but for the history graph.

val iter : [> Perms.read ] t -> min:commit_key list -> max:commit_key list -> ?commit:(commit_key -> unit Lwt.t) -> ?edge:(commit_key -> commit_key -> unit Lwt.t) -> ?skip:(commit_key -> bool Lwt.t) -> ?rev:bool -> unit -> unit Lwt.t

Same as Node.Graph.iter but for traversing the history graph.