package volgo

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file num_status.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
(*******************************************************************************)
(*  Volgo - a Versatile OCaml Library for Git Operations                       *)
(*  Copyright (C) 2024-2025 Mathieu Barbin <mathieu.barbin@gmail.com>          *)
(*                                                                             *)
(*  This file is part of Volgo.                                                *)
(*                                                                             *)
(*  Volgo is free software; you can redistribute it and/or modify it under     *)
(*  the terms of the GNU Lesser General Public License as published by the     *)
(*  Free Software Foundation either version 3 of the License, or any later     *)
(*  version, with the LGPL-3.0 Linking Exception.                              *)
(*                                                                             *)
(*  Volgo is distributed in the hope that it will be useful, but WITHOUT ANY   *)
(*  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  *)
(*  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License and    *)
(*  the file `NOTICE.md` at the root of this repository for more details.      *)
(*                                                                             *)
(*  You should have received a copy of the GNU Lesser General Public License   *)
(*  and the LGPL-3.0 Linking Exception along with this library. If not, see    *)
(*  <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively.       *)
(*******************************************************************************)

open! Import

module Key = struct
  [@@@coverage off]

  type t =
    | One_file of Path_in_repo.t
    | Two_files of
        { src : Path_in_repo.t
        ; dst : Path_in_repo.t
        }
  [@@deriving_inline sexp_of]

  let sexp_of_t =
    (function
     | One_file arg0__001_ ->
       let res0__002_ = Path_in_repo.sexp_of_t arg0__001_ in
       Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "One_file"; res0__002_ ]
     | Two_files { src = src__004_; dst = dst__006_ } ->
       let bnds__003_ = ([] : _ Stdlib.List.t) in
       let bnds__003_ =
         let arg__007_ = Path_in_repo.sexp_of_t dst__006_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "dst"; arg__007_ ] :: bnds__003_
          : _ Stdlib.List.t)
       in
       let bnds__003_ =
         let arg__005_ = Path_in_repo.sexp_of_t src__004_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "src"; arg__005_ ] :: bnds__003_
          : _ Stdlib.List.t)
       in
       Sexplib0.Sexp.List (Sexplib0.Sexp.Atom "Two_files" :: bnds__003_)
     : t -> Sexplib0.Sexp.t)
  ;;

  [@@@deriving.end]

  let compare =
    (fun a__001_ b__002_ ->
       if a__001_ == b__002_
       then 0
       else (
         match a__001_, b__002_ with
         | One_file _a__003_, One_file _b__004_ -> Path_in_repo.compare _a__003_ _b__004_
         | One_file _, _ -> -1
         | _, One_file _ -> 1
         | Two_files _a__005_, Two_files _b__006_ ->
           (match Path_in_repo.compare _a__005_.src _b__006_.src with
            | 0 -> Path_in_repo.compare _a__005_.dst _b__006_.dst
            | n -> n))
     : t -> t -> int)
  ;;

  let equal =
    (fun a__007_ b__008_ ->
       if a__007_ == b__008_
       then true
       else (
         match a__007_, b__008_ with
         | One_file _a__009_, One_file _b__010_ -> Path_in_repo.equal _a__009_ _b__010_
         | One_file _, _ -> false
         | _, One_file _ -> false
         | Two_files _a__011_, Two_files _b__012_ ->
           Path_in_repo.equal _a__011_.src _b__012_.src
           && Path_in_repo.equal _a__011_.dst _b__012_.dst)
     : t -> t -> bool)
  ;;

  let seeded_hash = (Hashtbl.seeded_hash : int -> t -> int)
  let hash = (Hashtbl.hash : t -> int)
end

module Change = struct
  [@@@coverage off]

  module Num_stat = struct
    type t =
      | Num_lines_in_diff of Num_lines_in_diff.t
      | Binary_file
    [@@deriving_inline sexp_of]

    let sexp_of_t =
      (function
       | Num_lines_in_diff arg0__008_ ->
         let res0__009_ = Num_lines_in_diff.sexp_of_t arg0__008_ in
         Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "Num_lines_in_diff"; res0__009_ ]
       | Binary_file -> Sexplib0.Sexp.Atom "Binary_file"
       : t -> Sexplib0.Sexp.t)
    ;;

    [@@@deriving.end]

    let equal =
      (fun a__008_ b__009_ ->
         if a__008_ == b__009_
         then true
         else (
           match a__008_, b__009_ with
           | Num_lines_in_diff _a__010_, Num_lines_in_diff _b__011_ ->
             Num_lines_in_diff.equal _a__010_ _b__011_
           | Num_lines_in_diff _, _ -> false
           | _, Num_lines_in_diff _ -> false
           | Binary_file, Binary_file -> true)
       : t -> t -> bool)
    ;;
  end

  type t =
    { key : Key.t
    ; num_stat : Num_stat.t
    }
  [@@deriving_inline sexp_of]

  let sexp_of_t =
    (fun { key = key__011_; num_stat = num_stat__013_ } ->
       let bnds__010_ = ([] : _ Stdlib.List.t) in
       let bnds__010_ =
         let arg__014_ = Num_stat.sexp_of_t num_stat__013_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "num_stat"; arg__014_ ] :: bnds__010_
          : _ Stdlib.List.t)
       in
       let bnds__010_ =
         let arg__012_ = Key.sexp_of_t key__011_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "key"; arg__012_ ] :: bnds__010_
          : _ Stdlib.List.t)
       in
       Sexplib0.Sexp.List bnds__010_
     : t -> Sexplib0.Sexp.t)
  ;;

  [@@@deriving.end]

  let equal =
    (fun a__014_ b__015_ ->
       if a__014_ == b__015_
       then true
       else
         Key.equal a__014_.key b__015_.key
         && Num_stat.equal a__014_.num_stat b__015_.num_stat
     : t -> t -> bool)
  ;;
end

module T = struct
  type t = Change.t list [@@deriving_inline sexp_of]

  let sexp_of_t =
    (fun x__015_ -> sexp_of_list Change.sexp_of_t x__015_ : t -> Sexplib0.Sexp.t)
  ;;

  [@@@deriving.end]
end

include T

module Changed = struct
  [@@@coverage off]

  type t = Name_status.Changed.t =
    | Between of
        { src : Rev.t
        ; dst : Rev.t
        }
  [@@deriving_inline sexp_of]

  let sexp_of_t =
    (fun (Between { src = src__017_; dst = dst__019_ }) ->
       let bnds__016_ = ([] : _ Stdlib.List.t) in
       let bnds__016_ =
         let arg__020_ = Rev.sexp_of_t dst__019_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "dst"; arg__020_ ] :: bnds__016_
          : _ Stdlib.List.t)
       in
       let bnds__016_ =
         let arg__018_ = Rev.sexp_of_t src__017_ in
         (Sexplib0.Sexp.List [ Sexplib0.Sexp.Atom "src"; arg__018_ ] :: bnds__016_
          : _ Stdlib.List.t)
       in
       Sexplib0.Sexp.List (Sexplib0.Sexp.Atom "Between" :: bnds__016_)
     : t -> Sexplib0.Sexp.t)
  ;;

  [@@@deriving.end]

  let equal =
    (fun a__022_ b__023_ ->
       if a__022_ == b__023_
       then true
       else (
         match a__022_, b__023_ with
         | Between _a__024_, Between _b__025_ ->
           Rev.equal _a__024_.src _b__025_.src && Rev.equal _a__024_.dst _b__025_.dst)
     : t -> t -> bool)
  ;;
end