Module B0_vcs
Version control system (VCS) repositories.
VCS kinds
val pp_kind : kind B0_std.Fmt.tpp_kindformats types of VCS.
Version control system repositories
val repo_dir : t -> B0_std.Fpath.trepo_dir risr's repository directory (not the working directory).
val work_dir : t -> B0_std.Fpath.twork_dir risr's working directory.
val cmd : t -> B0_std.Cmd.tcmd ris 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.tppformats a repository.
Finding repositories
val find : ?dir:B0_std.Fpath.t -> unit -> (t option, string) Stdlib.resultfind ~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.resultgetis likefindbut errors if no VCS was found.
Commits
type commit_ish= stringThe 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= stringThe 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_ishheadis"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.resultcommit_id r ~dirty_mark ~commit_ishis the object name (identifier) ofcommit_ish. Ifcommit_ishis"HEAD"anddirty_markistrue(default) and the working tree ofris_dirty, a mark gets appended to the commit identifier.
val commit_ptime_s : t -> commit_ish -> (int, string) Stdlib.resultcommit_ptime_s t commit_ishis the POSIX time in seconds of commitcommit_ishof repositoryr.
val changes : t -> after:commit_ish -> until:commit_ish -> ((commit_id * string) list, string) Stdlib.resultchanges r ~after ~untilis the list of commits with their one-line synopsis from commit-ishafterto commit-ishuntil.
val tracked_files : t -> tree_ish:string -> (B0_std.Fpath.t list, string) Stdlib.resulttracked_files ~tree_ish rare the files tracked by the tree objecttree_ish.
val commit_files : ?msg:string -> t -> B0_std.Fpath.t list -> (unit, string) Stdlib.resultcommit_files r ~msg filescommits the filefileswith messagemsg(if unspecified the VCS should prompt).
Working directory
val is_dirty : t -> (bool, string) Stdlib.resultis_dirty risOk trueiff the working directory ofrhas uncommited changes.
val not_dirty : t -> (unit, string) Stdlib.resultnot_dirtyisOk ()iff the working directory ofris not dirty and an error that enjoins to stash or commit otherwise.
val file_is_dirty : t -> B0_std.Fpath.t -> (bool, string) Stdlib.resultfile_is_dirty r fisOk trueifffhas uncommited changes.
val checkout : ?and_branch:string -> t -> commit_ish -> (unit, string) Stdlib.resultcheckout r ~and_branch commit_ishchecks outcommit_ishin the working directory ofr. Checks out in a new branchand_branchif provided. This fails if the current working directoryis_dirty.
val clone : t -> dir:B0_std.Fpath.t -> (t, string) Stdlib.resultclone r ~dirclonesrto a working directorydirand returns a repo to operate on it.
Tags
val tags : t -> (tag list, string) Stdlib.resulttags ris the list of tags in the repor.
val tag : ?msg:string -> t -> force:bool -> sign:bool -> commit_ish -> tag -> (unit, string) Stdlib.resulttag r ~force ~sign ~msg commit_ish ttagscommit_ishwithtand messagemsg(if unspecified the VCS should prompt). Ifsignistrue(defaults tofalse) signs the tag (`Gitrepos only). Ifforceistrue(default tofalse) doesn't fail if the tag already exists.
val delete_tag : t -> tag -> (unit, string) Stdlib.resultdelete_tag r tdeletes tagtin repor.
val describe : t -> dirty_mark:bool -> commit_ish -> (string, string) Stdlib.resultdescribe r dirty_mark commit_ishidentifiescommit_ish(defaults to"HEAD") using tags from the repositoryr. Ifcommit_ishis"HEAD"anddirty_markistrue(default) and the working tree ofris_dirty, a mark gets appended to the description.
Git specific operations
module Git : sig ... endGit specific operations.