Module Vcs.Mock_revs

Maintaining a mapping between mock revs and actual revs.

This is used to build reproducible tests.

type t

t is a mutable data structure that holds a bidirectional mapping between actual and mock revisions.

val create : unit -> t
val next : t -> Rev.t

Generate a new mock rev, not bound to any particular actual revision.

val add_exn : t -> rev:Rev.t -> mock_rev:Rev.t -> unit

Add a binding between a revision and a mock revision. This raises if such revisions are already bound in t.

val to_mock : t -> rev:Rev.t -> Rev.t

Given a revision of an actual repository, resolve it and return the mock revision that is bound to it in t. If this rev isn't bound to any mock rev in t yet, this function will call next to build a new mock revision, bind it in t and return it.

val of_mock : t -> mock_rev:Rev.t -> Rev.t option

Return the revision bound to the given mock rev, or None if this mock revision is unbound.