Library
Module
Module type
Parameter
Class
Class type
Git Manipulation
The Git
plugin provides Git-related combinators. It defines types for local Git repositories, Git commits inside these repositories and shell command to run on a given checkout.
val v : ?remote:string -> logs:Live_log.manager -> string -> t
v ~remote ~logs dir
is the local Git repository at dir
. If dir
does not exist, it is created by git clone remote
. If remote
is not given and dir
does not exist, an exception is raised.
val hash : commit -> string
hash c
is c
's hash.
is_after ~old c
is true iff old
appears in the history of c
.
fetch_head t target
evaluates to a local branch in t
with a copy of target
's head commit (downloading it first if needed).
val with_checkout :
log:Live_log.t ->
job_id:job_id ->
commit ->
(string -> 'a Lwt.t) ->
'a Lwt.t
with_checkout ~log ~job_id commit fn
is fn path
, where path
is the path of a local checkout of commit
. path
must not be used after fn
's thread terminates. The directory is locked while fn
runs with job_id
displayed to show why it is busy.
val with_clone :
log:Live_log.t ->
job_id:job_id ->
commit ->
(string -> 'a Lwt.t) ->
'a Lwt.t
with_clone
is similar to with_checkout
but clones the repository to a temporary directory first. This means that the repository does not need to be locked while the callback function runs.
val command :
logs:Live_log.manager ->
timeout:float ->
label:string ->
clone:bool ->
string array list ->
command
command ~logs ~timeout ~label ~clone cmds
is a caching executor of cmds
, which caches results in a branch whose name includes label
. The command will be terminated if it exceeds timeout
seconds. If clone
is set then with_clone
is used rather than with_checkout
. Note: every command must have a unique label!