Skip to content

Commit

Permalink
Rename vcs-git-cli => vcs-git-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Sep 20, 2024
1 parent 5a24299 commit 3529550
Show file tree
Hide file tree
Showing 64 changed files with 94 additions and 79 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Changed

- Rename `vcs-git-cli` to `vcs-git-provider` (breaking change).
- Rename `vcs-git` to `vcs-git-eio` (breaking change).
- Rename `tree` to `graph` to designate the commit graph of a repository (breaking change).
- Upgrade to `cmdlang.0.0.5`.
Expand Down
16 changes: 8 additions & 8 deletions doc/docs/design/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ The `vcs` repository contains several components:
stateDiagram-v2
vcs : vcs *
user : user-lib *
vcs_git_cli : vcs-git-cli
vcs_git_provider : vcs-git-provider
executable : executable (eio)
provider : vcs-git
provider : vcs-git-eio
runtime : eio
vcs --> user
user --> executable
vcs_git_cli --> provider
vcs_git_provider --> provider
runtime --> provider
provider --> executable
```
Expand All @@ -33,21 +33,21 @@ stateDiagram-v2
Also marked with a * to indicate no runtime dependencies.
- **executable**: A placeholder for a runtime component based on `user-lib` that
commits to a specific provider and concurrency model.
- **vcs-git-cli**: A IO-free library that parses the output of a `git` cli process.
- **vcs-git**: An instantiation of `Vcs_git_cli` based on an `Eio` runtime.
- **vcs-git-blocking**: An instantiation of `Vcs_git_cli` based on the OCaml `Stdlib`.
- **vcs-git-provider**: A IO-free library that parses the output of a `git` cli process.
- **vcs-git-eio**: An instantiation of `Vcs_git_provider` based on an `Eio` runtime.
- **vcs-git-blocking**: An instantiation of `Vcs_git_provider` based on the OCaml `Stdlib`.

```mermaid
stateDiagram-v2
vcs : vcs *
user : user-lib *
vcs_git_cli : vcs-git-cli
vcs_git_provider : vcs-git-provider
executable : executable (blocking)
provider : vcs-git-blocking
runtime : stdlib
vcs --> user
user --> executable
vcs_git_cli --> provider
vcs_git_provider --> provider
runtime --> provider
provider --> executable
```
Expand Down
13 changes: 7 additions & 6 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
(= :version))))

(package
(name vcs-git-cli)
(name vcs-git-provider)
(synopsis "An IO-free library that parses the output of Git commands")
(depends
(ocaml
Expand Down Expand Up @@ -235,7 +235,8 @@

(package
(name vcs-git-eio)
(synopsis "A Git provider for Vcs based on Vcs_git_cli for Eio programs")
(synopsis
"A Git provider for Vcs based on Vcs_git_provider for Eio programs")
(depends
(ocaml
(>= 5.2))
Expand Down Expand Up @@ -283,15 +284,15 @@
(>= 0.0.8))
(vcs
(= :version))
(vcs-git-cli
(vcs-git-provider
(= :version))
(vcs-private-libs-eio
(= :version))))

(package
(name vcs-git-blocking)
(synopsis
"A Git provider for Vcs based on Vcs_git_cli for blocking programs")
"A Git provider for Vcs based on Vcs_git_provider for blocking programs")
(depends
(ocaml
(>= 5.2))
Expand Down Expand Up @@ -337,7 +338,7 @@
(>= 0.0.8))
(vcs
(= :version))
(vcs-git-cli
(vcs-git-provider
(= :version))))

(package
Expand Down Expand Up @@ -457,7 +458,7 @@
(= :version))
(vcs-git-blocking
(= :version))
(vcs-git-cli
(vcs-git-provider
(= :version))
(vcs-private-libs-base
(= :version))
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
fpath
fpath-base
vcs
vcs_git_cli)
vcs_git_provider)
(instrumentation
(backend bisect_ppx))
(lint
Expand Down
4 changes: 2 additions & 2 deletions lib/vcs/test/test__graph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ let%expect_test "graph" =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.log") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
List.map lines ~f:(fun line -> Vcs_git_cli.Log.parse_log_line_exn ~line)
List.map lines ~f:(fun line -> Vcs_git_provider.Log.parse_log_line_exn ~line)
in
let refs =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.refs") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
Vcs_git_cli.Refs.parse_lines_exn ~lines
Vcs_git_provider.Refs.parse_lines_exn ~lines
in
let graph = Vcs.Graph.create () in
print_s [%sexp { node_count = (Vcs.Graph.node_count graph : int) }];
Expand Down
4 changes: 3 additions & 1 deletion lib/vcs/test/test__log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ let%expect_test "parse_exn" =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.log") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
let log = List.map lines ~f:(fun line -> Vcs_git_cli.Log.parse_log_line_exn ~line) in
let log =
List.map lines ~f:(fun line -> Vcs_git_provider.Log.parse_log_line_exn ~line)
in
let roots = Vcs.Log.roots log in
print_s [%sexp (roots : Vcs.Rev.t list)];
[%expect
Expand Down
4 changes: 2 additions & 2 deletions lib/vcs/test/test__name_status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let%expect_test "parse_exn" =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.name-status") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
let name_status = Vcs_git_cli.Name_status.parse_lines_exn ~lines in
let name_status = Vcs_git_provider.Name_status.parse_lines_exn ~lines in
let files_at_src = Vcs.Name_status.files_at_src name_status in
let files_at_dst = Vcs.Name_status.files_at_dst name_status in
print_s [%sexp (Set.diff files_at_dst files_at_src : Set.M(Vcs.Path_in_repo).t)];
Expand All @@ -47,7 +47,7 @@ let%expect_test "files" =
; "R100\toriginal_renamed_file\tnew_renamed_file"
]
in
let name_status = Vcs_git_cli.Name_status.parse_lines_exn ~lines in
let name_status = Vcs_git_provider.Name_status.parse_lines_exn ~lines in
print_s [%sexp (name_status : Vcs.Name_status.t)];
[%expect
{|
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs/test/test__num_status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let%expect_test "parse_exn" =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.num-status") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
let num_status = Vcs_git_cli.Num_status.parse_lines_exn ~lines in
let num_status = Vcs_git_provider.Num_status.parse_lines_exn ~lines in
ignore (num_status : Vcs.Num_status.t);
[%expect {||}];
()
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs_git_blocking/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Base
-open
Fpath_base)
(libraries base fpath fpath-base provider unix vcs vcs-git-cli)
(libraries base fpath fpath-base provider unix vcs vcs-git-provider)
(instrumentation
(backend bisect_ppx))
(lint
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs_git_blocking/src/runtime.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

type t

include Vcs_git_cli.Runtime.S with type t := t
include Vcs_git_provider.Runtime.S with type t := t

val create : unit -> t
6 changes: 3 additions & 3 deletions lib/vcs_git_blocking/src/vcs_git_blocking.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)
(*******************************************************************************)

type 'a t = ([> Vcs_git_cli.Trait.t ] as 'a) Vcs.t
type t' = Vcs_git_cli.Trait.t t
type 'a t = ([> Vcs_git_provider.Trait.t ] as 'a) Vcs.t
type t' = Vcs_git_provider.Trait.t t

module Impl = struct
include Runtime
include Vcs_git_cli.Make (Runtime)
include Vcs_git_provider.Make (Runtime)
end

let create () = Vcs.create (Provider.T { t = Impl.create (); handler = Impl.handler () })
8 changes: 4 additions & 4 deletions lib/vcs_git_blocking/src/vcs_git_blocking.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
(*_******************************************************************************)

(** Implementation of a git provider for the {!module:Vcs} library, based on
[Stdlib] and {!module:Vcs_git_cli}.
[Stdlib] and {!module:Vcs_git_provider}.
This implementation is based on the [git] command line tool. We run it as an
external program with utils from [Stdlib] and [Unix], producing the right
command line invocation and parsing the output to produce a typed version of
the expected results with [Vcs_git_cli]. Note that [git] must be found in the
the expected results with [Vcs_git_provider]. Note that [git] must be found in the
PATH of the running environment. *)

type 'a t = ([> Vcs_git_cli.Trait.t ] as 'a) Vcs.t
type 'a t = ([> Vcs_git_provider.Trait.t ] as 'a) Vcs.t

(** This is a convenient type alias that may be used to designate a provider
with the exact list of traits supported by this implementation. *)
type t' = Vcs_git_cli.Trait.t t
type t' = Vcs_git_provider.Trait.t t

val create : unit -> _ t
2 changes: 1 addition & 1 deletion lib/vcs_git_eio/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
fpath
fpath-base
vcs
vcs-git-cli
vcs-git-provider
vcs-private-libs-eio.eio-process)
(instrumentation
(backend bisect_ppx))
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs_git_eio/src/runtime.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

type t

include Vcs_git_cli.Runtime.S with type t := t
include Vcs_git_provider.Runtime.S with type t := t

val create : env:< fs : _ Eio.Path.t ; process_mgr : _ Eio.Process.mgr ; .. > -> t
6 changes: 3 additions & 3 deletions lib/vcs_git_eio/src/vcs_git_eio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)
(*******************************************************************************)

type 'a t = ([> Vcs_git_cli.Trait.t ] as 'a) Vcs.t
type t' = Vcs_git_cli.Trait.t t
type 'a t = ([> Vcs_git_provider.Trait.t ] as 'a) Vcs.t
type t' = Vcs_git_provider.Trait.t t

module Impl = struct
include Runtime
include Vcs_git_cli.Make (Runtime)
include Vcs_git_provider.Make (Runtime)
end

let create ~env =
Expand Down
8 changes: 4 additions & 4 deletions lib/vcs_git_eio/src/vcs_git_eio.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
(*_******************************************************************************)

(** Implementation of a git provider for the {!module:Vcs} library, based on
[Eio] and {!module:Vcs_git_cli}.
[Eio] and {!module:Vcs_git_provider}.
This implementation is based on the [git] command line tool. We run it as an
external program within an [Eio] environment, producing the right command line
invocation and parsing the output to produce a typed version of the expected
results with [Vcs_git_cli]. Note that [git] must be found in the PATH of the
results with [Vcs_git_provider]. Note that [git] must be found in the PATH of the
running environment. *)

type 'a t = ([> Vcs_git_cli.Trait.t ] as 'a) Vcs.t
type 'a t = ([> Vcs_git_provider.Trait.t ] as 'a) Vcs.t

(** This is a convenient type alias that may be used to designate a provider
with the exact list of traits supported by this implementation. *)
type t' = Vcs_git_cli.Trait.t t
type t' = Vcs_git_provider.Trait.t t

(** [create ~env] creates a [vcs] value that can be used by the {!module:Vcs}
library. *)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/vcs_git_cli/src/dune → lib/vcs_git_provider/src/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name vcs_git_cli)
(public_name vcs-git-cli)
(name vcs_git_provider)
(public_name vcs-git-provider)
(flags
:standard
-w
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@ let parse_exn str =
| exn ->
raise_s
[%sexp
"Vcs_git_cli.Munged_path.parse_exn", "invalid path", (str : string), (exn : Exn.t)]
"Vcs_git_provider.Munged_path.parse_exn"
, "invalid path"
, (str : string)
, (exn : Exn.t)]
;;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

(** Defining the interface of a compatible runtime.
The other modules defined by [Vcs_git_cli] are all functors that are
The other modules defined by [Vcs_git_provider] are all functors that are
parametrized by this interface. *)

module type S = sig
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
(*_ <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *)
(*_******************************************************************************)

(** [Vcs_git_cli] is a helper library to build git providers for the [Vcs] library.
(** [Vcs_git_provider] is a helper library to build git providers for the [Vcs]
library.
Given the ability to run a [git] process, [Vcs_git_cli] knows what command to
run, how to parse its output and how to interpret its exit code to turn it
into a typed result.
Given the ability to run a [git] process, [Vcs_git_provider] knows what
command to run, how to parse its output and how to interpret its exit code
to turn it into a typed result.
[Vcs_git_cli] is not meant to be used directly by a user. Rather it is one of
the building blocks involved in creating a git provider for the [Vcs]
[Vcs_git_provider] is not meant to be used directly by a user. Rather it is
one of the building blocks involved in creating a git provider for the [Vcs]
library.
[Vcs_git_cli] has currently two instantiations as part of its distribution
(packaged separately to keep the dependencies isolated).
[Vcs_git_provider] has currently two instantiations as part of its
distribution (packaged separately to keep the dependencies isolated).
- One based on the [Eio] runtime
- One based on the [Stdlib.Unix] runtime, for blocking programs.
Expand All @@ -46,7 +47,7 @@ module Runtime = Runtime
(** {1 Providers of Vcs Traits} *)

module Trait : sig
(** The list of traits that are implemented in [Vcs_git_cli]. *)
(** The list of traits that are implemented in [Vcs_git_provider]. *)
type t =
[ Vcs.Trait.add
| Vcs.Trait.branch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Testing the Git Command Line Interface Parsing Logic

This directory contains tests for the parsing logic implemented in the `Vcs_git_cli` module. The focus here is on validating the parsing of specific command outputs, rather than testing the entire process invocation. The latter is covered in the `Vcs_git_test` module.
This directory contains tests for the parsing logic implemented in the `Vcs_git_provider` module. The focus here is on validating the parsing of specific command outputs, rather than testing the entire process invocation. The latter is covered in the `Vcs_git_test` module.

## Testing Pattern

Expand Down
6 changes: 3 additions & 3 deletions lib/vcs_git_cli/test/dune → lib/vcs_git_provider/test/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name vcs_git_cli_test)
(public_name vcs-tests.vcs_git_cli_test)
(name vcs_git_provider_test)
(public_name vcs-tests.vcs_git_provider_test)
(inline_tests
(deps
(glob_files *.name-status)
Expand All @@ -22,7 +22,7 @@
eio
eio_main
expect_test_helpers_core.expect_test_helpers_base
vcs_git_cli)
vcs_git_provider)
(instrumentation
(backend bisect_ppx))
(lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ let%expect_test "parse_exn" =
let path = Eio.Path.(Eio.Stdenv.fs env / "super-master-mind.log") in
let contents = Eio.Path.load path in
let lines = String.split_lines contents in
let log = List.map lines ~f:(fun line -> Vcs_git_cli.Log.parse_log_line_exn ~line) in
let log =
List.map lines ~f:(fun line -> Vcs_git_provider.Log.parse_log_line_exn ~line)
in
let roots = Vcs.Log.roots log in
print_s [%sexp (roots : Vcs.Rev.t list)];
[%expect
Expand All @@ -52,7 +54,7 @@ let%expect_test "parse_exn" =

let%expect_test "invalid lines" =
let test line =
print_s [%sexp (Vcs_git_cli.Log.parse_log_line_exn ~line : Vcs.Log.Line.t)]
print_s [%sexp (Vcs_git_provider.Log.parse_log_line_exn ~line : Vcs.Log.Line.t)]
in
test "35760b109070be51b9deb61c8fdc79c0b2d9065d";
[%expect {| (Root (rev 35760b109070be51b9deb61c8fdc79c0b2d9065d)) |}];
Expand Down
File renamed without changes.
Loading

0 comments on commit 3529550

Please sign in to comment.