Module Topkg.Vcs
Version control system repositories.
Version control system repositories
val pp_kind : Stdlib.Format.formatter -> kind -> unit
pp_kind ppf k
prints an unspecified representation ofk
onppf
.
type commit_ish
= string
The type for symbols resolving to a commit. The module uses
"HEAD"
for specifying the current checkout; use this symbol even if the underlying VCS is`Hg
.
val cmd : t -> Cmd.t
cmd r
is the base VCS command to use to act onr
.Warning Prefer the functions below to remain VCS independent.
val find : ?dir:fpath -> unit -> t option result
find ~dir ()
looks for a VCS repository in working directorydir
(not the repository directory like.git
, default is guessed automatically).
val pp : Stdlib.Format.formatter -> t -> unit
pp ppf r
prints an unspecified representation ofr
onppf
.
Repository state
val is_dirty : t -> bool result
is_dirty r
isOk true
iff the working tree ofr
has uncommited changes.
val not_dirty : t -> unit 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 -> fpath -> bool result
file_id_dirty r f
isOk true
ifff
has uncommited changes.
val head : ?dirty:bool -> t -> string result
head ~dirty r
is the HEAD commit identifier of the repositoryr
. Ifdirty
istrue
(default), and indicator is appended to the commit identifier if the working tree ofr
is_dirty
.
val commit_id : ?dirty:bool -> ?commit_ish:commit_ish -> t -> string result
commit_id ~dirty ~commit_ish r
is the object name (identifier) ofcommit_ish
(defaults to"HEAD"
). Ifcommit_ish
is"HEAD"
anddirty
istrue
(default) and indicator is appended to the identifier if the working tree is dirty.
val commit_ptime_s : ?commit_ish:commit_ish -> t -> int result
commit_ptime_s t ~commit_ish
is the POSIX time in seconds of commitcommit_ish
(defaults to"HEAD"
) of repositoryr
.
val describe : ?dirty:bool -> ?commit_ish:commit_ish -> t -> string result
describe ~dirty ~commit_ish r
identifiescommit_ish
(defaults to"HEAD"
) using tags from the repositoryr
. Ifcommit_ish
is"HEAD"
anddirty
istrue
(default) an indicator is appended to the identifier if the working tree is dirty.
val changes : ?until:commit_ish -> t -> after:commit_ish -> (string * string) list result
changes r ~after ~until
is the list of commits with their one-line message from commit-ishafter
to commit-ishuntil
(defaults to"HEAD"
).
Repository operations
val checkout : ?branch:string -> t -> commit_ish:commit_ish -> unit result
checkout r ~branch commit_ish
checks outcommit_ish
. Checks out in a new branchbranch
if provided.
val commit_files : ?msg:string -> t -> fpath list -> unit result
commit_files r ~msg files
commits the filefiles
with messagemsg
(if unspecified the VCS should prompt).
val tag : ?force:bool -> ?sign:bool -> ?msg:string -> ?commit_ish:string -> t -> string -> unit 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.