forked from
anil.recoil.org/monopam
Monorepo management for opam overlays
1(** Verse collaboration diff operations.
2
3 Compares local repositories with verse member forks to identify commits that
4 can be pulled or cherry-picked. *)
5
6(** {1 Types} *)
7
8type entry = {
9 repo_name : string;
10 handle : string;
11 relationship : Forks.relationship;
12 commits : Git.Repository.log_entry list;
13 patches : (string * string) list;
14}
15(** A diff entry for a single repo/handle pair. *)
16
17type result = { entries : entry list; forks : Forks.t }
18(** Diff result containing entries and fork analysis. *)
19
20type commit_info = {
21 commit_repo : string;
22 commit_handle : string;
23 commit_hash : string;
24 commit_subject : string;
25 commit_author : string;
26 commit_patch : string;
27}
28(** Detailed information about a single commit. *)
29
30type handle_pull_result = {
31 repos_pulled : (string * int) list;
32 repos_skipped : string list;
33 repos_failed : (string * string) list;
34}
35(** Result of pulling from a handle. *)
36
37type cherrypick_result = {
38 repo_name : string;
39 commit_hash : string;
40 commit_subject : string;
41}
42(** Result of cherry-picking a commit. *)
43
44(** {1 Pretty Printers} *)
45
46val pp : show_patch:bool -> Format.formatter -> result -> unit
47(** [pp ~show_patch ppf result] pretty-prints a diff result. *)
48
49val pp_handle_pull_result : Format.formatter -> handle_pull_result -> unit
50(** [pp_handle_pull_result] pretty-prints a handle pull result. *)
51
52val pp_cherrypick_result : Format.formatter -> cherrypick_result -> unit
53(** [pp_cherrypick_result] pretty-prints a cherry-pick result. *)
54
55(** {1 Utilities} *)
56
57val is_commit_sha : string -> bool
58(** [is_commit_sha s] returns [true] if [s] looks like a git commit SHA. *)
59
60(** {1 Diff Operations} *)
61
62val compute :
63 sw:Eio.Switch.t ->
64 proc:_ Eio.Process.mgr ->
65 fs:Eio.Fs.dir_ty Eio.Path.t ->
66 config:Config.t ->
67 verse_config:Verse_config.t ->
68 ?repo:string ->
69 ?refresh:bool ->
70 ?patch:bool ->
71 unit ->
72 result
73(** [compute ~sw ~proc ~fs ~config ~verse_config ()] computes the diff between
74 local and verse state. *)
75
76val show_commit :
77 sw:Eio.Switch.t ->
78 proc:_ Eio.Process.mgr ->
79 fs:Eio.Fs.dir_ty Eio.Path.t ->
80 config:Config.t ->
81 verse_config:Verse_config.t ->
82 sha:string ->
83 ?refresh:bool ->
84 unit ->
85 commit_info option
86(** [show_commit ~sw ~proc ~fs ~config ~verse_config ~sha ()] shows details for
87 a specific commit in the verse diff. *)
88
89(** {1 Pull from Handle} *)
90
91val pull_from_handle :
92 sw:Eio.Switch.t ->
93 proc:_ Eio.Process.mgr ->
94 fs:Eio.Fs.dir_ty Eio.Path.t ->
95 config:Config.t ->
96 verse_config:Verse_config.t ->
97 handle:string ->
98 ?repo:string ->
99 ?refresh:bool ->
100 unit ->
101 (handle_pull_result, Ctx.error) Stdlib.result
102(** [pull_from_handle ~sw ~proc ~fs ~config ~verse_config ~handle ()] pulls
103 changes from a verse collaborator's handle. *)
104
105(** {1 Cherry-pick} *)
106
107val cherrypick :
108 sw:Eio.Switch.t ->
109 proc:_ Eio.Process.mgr ->
110 fs:Eio.Fs.dir_ty Eio.Path.t ->
111 config:Config.t ->
112 verse_config:Verse_config.t ->
113 sha:string ->
114 ?refresh:bool ->
115 unit ->
116 (cherrypick_result, Ctx.error) Stdlib.result
117(** [cherrypick ~sw ~proc ~fs ~config ~verse_config ~sha ()] cherry-picks a
118 commit from the verse diff. *)