Module B0_vcs
Version control system (VCS) repositories.
VCS kinds
val pp_kind : kind B0_std.Fmt.t
pp_kind
formats types of VCS.
Version control system repositories
val repo_dir : t -> B0_std.Fpath.t
repo_dir r
isr
's repository directory (not the working directory).
val work_dir : t -> B0_std.Fpath.t
work_dir r
isr
's working directory.
val cmd : t -> B0_std.Cmd.t
cmd r
is the base command to use to act onr
. Use only if you need VCS specific functionality not provided by the module.
val pp : t B0_std.Fmt.t
pp
formats a repository.
Finding repositories
val find : ?dir:B0_std.Fpath.t -> unit -> (t option, string) Stdlib.result
find ~dir ()
finds, using VCS functionality, a repository starting in directorydir
(if unspecified this is thecwd
).
val get : ?dir:B0_std.Fpath.t -> unit -> (t, string) Stdlib.result
get
is likefind
but errors if no VCS was found.
Commits
type commit_ish
= string
The type for symbols resolving to a commit. Important, the module uses
"HEAD"
for specifying the commit currently checkout in the working directory; use this symbol even if the underlying VCS isHg
.
type commit_id
= string
The type for commit identifiers. Note that the module sometimes appends the string
"-dirty"
to these identifiers in which case they are no longer.
val head : commit_ish
head
is"HEAD"
. A symbol to represent the commit currently checked out in the working directory.
val commit_id : t -> dirty_mark:bool -> commit_ish -> (commit_id, string) Stdlib.result
commit_id r ~dirty_mark ~commit_ish
is the object name (identifier) ofcommit_ish
. Ifcommit_ish
is"HEAD"
anddirty_mark
istrue
(default) and the working tree ofr
is_dirty
, a mark gets appended to the commit identifier.
val commit_ptime_s : t -> commit_ish -> (int, string) Stdlib.result
commit_ptime_s t commit_ish
is the POSIX time in seconds of commitcommit_ish
of repositoryr
.
val changes : t -> after:commit_ish -> until:commit_ish -> ((commit_id * string) list, string) Stdlib.result
changes r ~after ~until
is the list of commits with their one-line synopsis from commit-ishafter
to commit-ishuntil
.
val tracked_files : t -> tree_ish:string -> (B0_std.Fpath.t list, string) Stdlib.result
tracked_files ~tree_ish r
are the files tracked by the tree objecttree_ish
.
val commit_files : ?msg:string -> t -> B0_std.Fpath.t list -> (unit, string) Stdlib.result
commit_files r ~msg files
commits the filefiles
with messagemsg
(if unspecified the VCS should prompt).
Working directory
val is_dirty : t -> (bool, string) Stdlib.result
is_dirty r
isOk true
iff the working directory ofr
has uncommited changes.
val not_dirty : t -> (unit, string) Stdlib.result
not_dirty
isOk ()
iff the working directory ofr
is not dirty and an error that enjoins to stash or commit otherwise.
val file_is_dirty : t -> B0_std.Fpath.t -> (bool, string) Stdlib.result
file_is_dirty r f
isOk true
ifff
has uncommited changes.
val checkout : ?and_branch:string -> t -> commit_ish -> (unit, string) Stdlib.result
checkout r ~and_branch commit_ish
checks outcommit_ish
in the working directory ofr
. Checks out in a new branchand_branch
if provided. This fails if the current working directoryis_dirty
.
val clone : t -> dir:B0_std.Fpath.t -> (t, string) Stdlib.result
clone r ~dir
clonesr
to a working directorydir
and returns a repo to operate on it.
Tags
val tags : t -> (tag list, string) Stdlib.result
tags r
is the list of tags in the repor
.
val tag : ?msg:string -> t -> force:bool -> sign:bool -> commit_ish -> tag -> (unit, string) Stdlib.result
tag r ~force ~sign ~msg commit_ish t
tagscommit_ish
witht
and messagemsg
(if unspecified the VCS should prompt). Ifsign
istrue
(defaults tofalse
) signs the tag (`Git
repos only). Ifforce
istrue
(default tofalse
) doesn't fail if the tag already exists.
val delete_tag : t -> tag -> (unit, string) Stdlib.result
delete_tag r t
deletes tagt
in repor
.
val describe : t -> dirty_mark:bool -> commit_ish -> (string, string) Stdlib.result
describe r dirty_mark commit_ish
identifiescommit_ish
(defaults to"HEAD"
) using tags from the repositoryr
. Ifcommit_ish
is"HEAD"
anddirty_mark
istrue
(default) and the working tree ofr
is_dirty
, a mark gets appended to the description.
Git specific operations
module Git : sig ... end
Git specific operations.