Vcs.Hg
Manipulating the output of processes run by vcs and backends - typically the "hg"
command.
In the documentation below, we are referring to examples and functions based on the similar Git
module. This is because both modules Git
and this one are implemented from a shared code and interface.
They have the same interface, but the types of their output differ, for added type safety.
module Output : sig ... end
module type S = sig ... end
This is the interface commonly used by raising and non-raising helper modules, such as Vcs.Git
, Volgo_base.Vcs.Git.Or_error
, Vcs.Git.Result
, Vcs.Git.Rresult
, and custom ones built with Vcs.Git.Non_raising.Make
. S
is parametrized by the result type returned by the helpers.
The interface exposed at the top level of this module are helpers that return direct results, or raise Err.E
. This module is exported to users as Vcs.Git
.
The helpers are suitable for use in combination with the Vcs.git
function, which will take care of wrapping the exception with useful context, before re-raising it.
include S with type 'a result := 'a
val exit0 : Output.t -> unit
val exit0_and_stdout : Output.t -> string
val exit_code : Output.t -> accept:(int * 'a) list -> 'a
A convenient wrapper to write exhaustive match on a result conditioned by a list of accepted exit codes. If the exit code is not part of the accepted list, the function takes care of returning an error of the expected result type.
module Non_raising : sig ... end
A functor to build non raising helpers based on a custom error type.
Helpers to wrap process outputs.