Skip to content

Commit

Permalink
Merge pull request #43 from mbarbin/upgrade-provider
Browse files Browse the repository at this point in the history
Upgrade provider
  • Loading branch information
mbarbin authored Nov 5, 2024
2 parents 39d9313 + 6c4dad1 commit 0ccfbf0
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 131 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

### Changed

- Abstract the trait type constructors (PR, @mbarbin).
- Upgrade to `provider.0.0.11` with breaking changes (PR, @mbarbin).
- Abstract the trait type constructors (#42, @mbarbin).

### Deprecated

Expand Down
12 changes: 6 additions & 6 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))))
(>= 0.0.11))))

(package
(name vcs-base)
Expand Down Expand Up @@ -89,7 +89,7 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))
(>= 0.0.11))
(vcs
(= :version))))

Expand Down Expand Up @@ -187,7 +187,7 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))
(>= 0.0.11))
(sexplib0
(and
(>= v0.17)
Expand Down Expand Up @@ -219,7 +219,7 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))
(>= 0.0.11))
(sexplib0
(and
(>= v0.17)
Expand Down Expand Up @@ -327,7 +327,7 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))
(>= 0.0.11))
(re
(>= 1.8.0))
(sexp_pretty
Expand Down Expand Up @@ -404,4 +404,4 @@
(ppxlib
(>= 0.33))
(provider
(>= 0.0.8))))
(>= 0.0.11))))
98 changes: 42 additions & 56 deletions lib/vcs/src/trait.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ and add_ty
module Add = struct
module type S = Trait_add.S

type (_, _, _) Provider.Trait.t +=
| Add : ('t, (module S with type t = 't), [> add ]) Provider.Trait.t

let t = Add
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type branch = [ `Branch of branch_ty ]
Expand All @@ -37,10 +36,9 @@ and branch_ty
module Branch = struct
module type S = Trait_branch.S

type (_, _, _) Provider.Trait.t +=
| Branch : ('t, (module S with type t = 't), [> branch ]) Provider.Trait.t

let t = Branch
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type commit = [ `Commit of commit_ty ]
Expand All @@ -49,10 +47,9 @@ and commit_ty
module Commit = struct
module type S = Trait_commit.S

type (_, _, _) Provider.Trait.t +=
| Commit : ('t, (module S with type t = 't), [> commit ]) Provider.Trait.t

let t = Commit
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type config = [ `Config of config_ty ]
Expand All @@ -61,10 +58,9 @@ and config_ty
module Config = struct
module type S = Trait_config.S

type (_, _, _) Provider.Trait.t +=
| Config : ('t, (module S with type t = 't), [> config ]) Provider.Trait.t

let t = Config
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type file_system = [ `File_system of file_system_ty ]
Expand All @@ -73,10 +69,9 @@ and file_system_ty
module File_system = struct
module type S = Trait_file_system.S

type (_, _, _) Provider.Trait.t +=
| File_system : ('t, (module S with type t = 't), [> file_system ]) Provider.Trait.t

let t = File_system
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type git = [ `Git of git_ty ]
Expand All @@ -85,10 +80,9 @@ and git_ty
module Git = struct
module type S = Trait_git.S

type (_, _, _) Provider.Trait.t +=
| Git : ('t, (module S with type t = 't), [> git ]) Provider.Trait.t

let t = Git
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type init = [ `Init of init_ty ]
Expand All @@ -97,10 +91,9 @@ and init_ty
module Init = struct
module type S = Trait_init.S

type (_, _, _) Provider.Trait.t +=
| Init : ('t, (module S with type t = 't), [> init ]) Provider.Trait.t

let t = Init
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type log = [ `Log of log_ty ]
Expand All @@ -109,10 +102,9 @@ and log_ty
module Log = struct
module type S = Trait_log.S

type (_, _, _) Provider.Trait.t +=
| Log : ('t, (module S with type t = 't), [> log ]) Provider.Trait.t

let t = Log
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type ls_files = [ `Ls_files of ls_files_ty ]
Expand All @@ -121,10 +113,9 @@ and ls_files_ty
module Ls_files = struct
module type S = Trait_ls_files.S

type (_, _, _) Provider.Trait.t +=
| Ls_files : ('t, (module S with type t = 't), [> ls_files ]) Provider.Trait.t

let t = Ls_files
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type name_status = [ `Name_status of name_status_ty ]
Expand All @@ -133,10 +124,9 @@ and name_status_ty
module Name_status = struct
module type S = Trait_name_status.S

type (_, _, _) Provider.Trait.t +=
| Name_status : ('t, (module S with type t = 't), [> name_status ]) Provider.Trait.t

let t = Name_status
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type num_status = [ `Num_status of num_status_ty ]
Expand All @@ -145,10 +135,9 @@ and num_status_ty
module Num_status = struct
module type S = Trait_num_status.S

type (_, _, _) Provider.Trait.t +=
| Num_status : ('t, (module S with type t = 't), [> num_status ]) Provider.Trait.t

let t = Num_status
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type refs = [ `Refs of refs_ty ]
Expand All @@ -157,10 +146,9 @@ and refs_ty
module Refs = struct
module type S = Trait_refs.S

type (_, _, _) Provider.Trait.t +=
| Refs : ('t, (module S with type t = 't), [> refs ]) Provider.Trait.t

let t = Refs
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type rev_parse = [ `Rev_parse of rev_parse_ty ]
Expand All @@ -169,10 +157,9 @@ and rev_parse_ty
module Rev_parse = struct
module type S = Trait_rev_parse.S

type (_, _, _) Provider.Trait.t +=
| Rev_parse : ('t, (module S with type t = 't), [> rev_parse ]) Provider.Trait.t

let t = Rev_parse
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type show = [ `Show of show_ty ]
Expand All @@ -181,10 +168,9 @@ and show_ty
module Show = struct
module type S = Trait_show.S

type (_, _, _) Provider.Trait.t +=
| Show : ('t, (module S with type t = 't), [> show ]) Provider.Trait.t

let t = Show
include Provider.Trait.Create (struct
type 'a module_type = (module S with type t = 'a)
end)
end

type t =
Expand Down
2 changes: 1 addition & 1 deletion lib/vcs/src/vcs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type -'a t = 'a Vcs0.t
(** [create provider] returns a [vcs] that implements a given set of traits.
Typical users do not use [create] directly, but rather will rely on an
actual provider. See for example [Vcs_git_eio.create]. *)
val create : 'a Provider.t -> 'a t
val create : 'a Provider.packed -> 'a t

(** {1 Error handling}
Expand Down
Loading

0 comments on commit 0ccfbf0

Please sign in to comment.