package dune-release

  1. Overview
  2. Docs

VCS repositories.

VCS

Version control system repositories

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.

type t

The type for version control systems repositories.

val cmd : t -> Bos.Cmd.t

cmd r is the base VCS command to use to act on r.

Warning Prefer the functions below to remain VCS independent.

val get : ?dir:Fpath.t -> unit -> (t, Rresult.R.msg) Rresult.result

get is like find but returns an error if no VCS was found.

Repository state

val is_dirty : t -> (bool, Rresult.R.msg) Rresult.result

is_dirty r is Ok true iff the working tree of r has uncommited changes.

val commit_id : ?dirty:bool -> ?commit_ish:commit_ish -> t -> (string, Rresult.R.msg) Rresult.result

commit_id ~dirty ~commit_ish r is the object name (identifier) of commit_ish (defaults to "HEAD"). If commit_ish is "HEAD" and dirty is true (default) and indicator is appended to the identifier if the working tree is dirty.

val commit_ptime_s : dry_run:bool -> ?commit_ish:commit_ish -> t -> (int, Rresult.R.msg) Rresult.result

commit_ptime_s t ~commit_ish is the POSIX time in seconds of commit commit_ish (defaults to "HEAD") of repository r.

val describe : ?dirty:bool -> ?commit_ish:commit_ish -> t -> (string, Rresult.R.msg) Rresult.result

describe ~dirty ~commit_ish r identifies commit_ish (defaults to "HEAD") using tags from the repository r. If commit_ish is "HEAD" and dirty is true (default) an indicator is appended to the identifier if the working tree is dirty.

val tag_exists : dry_run:bool -> t -> string -> bool
val tag_points_to : t -> tag:string -> string option
val branch_exists : dry_run:bool -> t -> string -> bool

Repository operations

val clone : dry_run:bool -> ?force:bool -> ?branch:string -> dir:Fpath.t -> t -> (unit, Rresult.R.msg) Rresult.result

clone ~dir r clones r in directory dir.

val checkout : dry_run:bool -> ?branch:string -> t -> commit_ish:commit_ish -> (unit, Rresult.R.msg) Rresult.result

checkout r ~branch commit_ish checks out commit_ish. Checks out in a new branch branch if provided.

val tag : dry_run:bool -> ?force:bool -> ?sign:bool -> ?msg:string -> ?commit_ish:string -> t -> string -> (unit, Rresult.R.msg) Rresult.result

tag r ~force ~sign ~msg ~commit_ish t tags commit_ish with t and message msg (if unspecified the VCS should prompt). if sign is true (defaults to false) signs the tag (`Git repos only). If force is true (default to false) doesn't fail if the tag already exists.

val delete_tag : dry_run:bool -> t -> string -> (unit, Rresult.R.msg) Rresult.result

delete_tag r t deletes tag t in repo r.

OCaml

Innovation. Community. Security.