Module Vcs.Rresult

An Vcs API in the style of Rresult.

type err = [
  1. | `Vcs of Vcs.Err.t
]
val sexp_of_err : err -> Sexplib0.Sexp.t
type 'a t = ('a, err) Stdlib.Result.t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
type 'a result = 'a t

Utils

This part exposes the functions prescribed by the Rresult usage design guidelines.

val pp_error : Stdlib.Format.formatter -> [ `Vcs of Vcs.Err.t ] -> unit
val open_error : 'a result -> ('a, [> `Vcs of Vcs.Err.t ]) Stdlib.Result.t
val error_to_msg : 'a result -> ('a, [ `Msg of string ]) Stdlib.Result.t

Non raising API

The individual functions are documented the Vcs module.

include Vcs.Non_raising.S with type 'a t := 'a Vcs__.Vcs0.t and type 'a result := 'a result
val init : [> Vcs.Trait.init ] Vcs__.Vcs0.t -> path:Fpath_sexp0.Absolute_path.t -> Vcs.Repo_root.t result
val find_enclosing_git_repo_root : [> Vcs.Trait.file_system ] Vcs__.Vcs0.t -> from:Fpath_sexp0.Absolute_path.t -> Vcs.Repo_root.t option result
val find_enclosing_repo_root : [> Vcs.Trait.file_system ] Vcs__.Vcs0.t -> from:Fpath_sexp0.Absolute_path.t -> store:(Fpath_sexp0.Fsegment.t * 'store) list -> ('store * Vcs.Repo_root.t) option result
val add : [> Vcs.Trait.add ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> path:Vcs.Path_in_repo.t -> unit result
val commit : [> Vcs.Trait.rev_parse | Vcs.Trait.commit ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> commit_message:Vcs.Commit_message.t -> Vcs.Rev.t result
val current_branch : [> Vcs.Trait.rev_parse ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> Vcs.Branch_name.t result
val current_revision : [> Vcs.Trait.rev_parse ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> Vcs.Rev.t result
val ls_files : [> Vcs.Trait.ls_files ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> below:Vcs.Path_in_repo.t -> Vcs.Path_in_repo.t list result
val show_file_at_rev : [> Vcs.Trait.show ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> rev:Vcs.Rev.t -> path:Vcs.Path_in_repo.t -> [ `Present of Vcs.File_contents.t | `Absent ] result
val load_file : [> Vcs.Trait.file_system ] Vcs__.Vcs0.t -> path:Fpath_sexp0.Absolute_path.t -> Vcs.File_contents.t result
val save_file : ?perms:int -> [> Vcs.Trait.file_system ] Vcs__.Vcs0.t -> path:Fpath_sexp0.Absolute_path.t -> file_contents:Vcs.File_contents.t -> unit result
val read_dir : [> Vcs.Trait.file_system ] Vcs__.Vcs0.t -> dir:Fpath_sexp0.Absolute_path.t -> Fpath_sexp0.Fsegment.t list result
val rename_current_branch : [> Vcs.Trait.branch ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> to_:Vcs.Branch_name.t -> unit result
val name_status : [> Vcs.Trait.name_status ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> changed:Vcs.Name_status.Changed.t -> Vcs.Name_status.t result
val num_status : [> Vcs.Trait.num_status ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> changed:Vcs.Num_status.Changed.t -> Vcs.Num_status.t result
val log : [> Vcs.Trait.log ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> Vcs.Log.t result
val refs : [> Vcs.Trait.refs ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> Vcs.Refs.t result
val graph : [> Vcs.Trait.log | Vcs.Trait.refs ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> Vcs.Graph.t result
val set_user_name : [> Vcs.Trait.config ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> user_name:Vcs.User_name.t -> unit result
val set_user_email : [> Vcs.Trait.config ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> user_email:Vcs.User_email.t -> unit result
val git : ?env:string array -> ?run_in_subdir:Vcs.Path_in_repo.t -> [> Vcs.Trait.git ] Vcs__.Vcs0.t -> repo_root:Vcs.Repo_root.t -> args:string list -> f:(Vcs__.Git_output0.t -> 'a result) -> 'a result

See the note in Vcs.git about error handling with respect to exceptions raised by f.

Some helpers dedicated to the corresponding result type are provided by the module Vcs.Git. They are convenient to use to build the f parameter.