Skip to content

Commit

Permalink
Merge pull request #430 from avsm/more-target-fun
Browse files Browse the repository at this point in the history
[ci] expose more functions on `Target.v`
  • Loading branch information
talex5 committed Jan 9, 2017
2 parents 7479933 + e92267f commit 6811870
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ci/src/cI_target.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ let path = function

type v = [ `PR of PR.t | `Ref of Ref.t ]

let pp_v f = function
| `PR pr -> Fmt.pf f "prs/%a" PR.pp pr
| `Ref x -> Fmt.pf f "refs/%a" Ref.pp x

let head = function
| `PR x -> PR.commit x
| `Ref x -> Ref.commit x
Expand All @@ -96,3 +100,7 @@ let compare_v (x:v) (y:v) = Elt.compare (x :> Elt.t) (y :> Elt.t)
let path_v = function
| `PR pr -> path (`PR (PR.id pr))
| `Ref r -> path (`Ref (Ref.id r))

let repo_v = function
| `PR pr -> PR.repo pr
| `Ref r -> Ref.repo r
2 changes: 2 additions & 0 deletions ci/src/cI_target.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ type v = [ `PR of PR.t | `Ref of Ref.t ]
val head: v -> Commit.t
val compare_v: v -> v -> int
val path_v: v -> string
val repo_v : v -> Repo.t
val unescape_ref: string -> Ref.name
val pp_v : v Fmt.t
5 changes: 5 additions & 0 deletions ci/src/datakit_ci.mli
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ module Target: sig
val compare_v: v -> v -> int
(** [compare_v] compares values of type {!v}. *)

val repo_v: v -> Repo.t
(** [repo_v v] is [v]'s repository. *)

val pp_v: v Fmt.t
(** [pp_v] is the pretty-printer for resolved GitHub targets. *)
end

module Term: sig
Expand Down

0 comments on commit 6811870

Please sign in to comment.