Skip to content

Commit

Permalink
114.20+69
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremie Dimino committed Dec 23, 2016
1 parent 59a43c8 commit d923848
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 118 deletions.
2 changes: 1 addition & 1 deletion client/cmd_review_ddiff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Or, staging the computation of ddiffs:
match what_to_diff with
| `Read_diff4s_from_sexp_file sexp_file ->
let%map stdin = Reader.file_contents sexp_file in
Sexp.of_string_conv_exn (String.strip stdin)
Sexp.of_string_conv_exn stdin
[%of_sexp: Diff4.Stable.V2.t list]

| `Rev_diamond rev_diamond ->
Expand Down
2 changes: 1 addition & 1 deletion client/scaffold.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ end = struct
;;

let parse_exn s =
of_on_disk ([%of_sexp: On_disk.t] (Sexp.of_string (String.strip s)))
of_on_disk ([%of_sexp: On_disk.t] (Sexp.of_string s))
;;

end
Expand Down
2 changes: 1 addition & 1 deletion common/app_harness.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ let start ~init_stds ~log_format ~main ~basedir ~mode ~fg () =
let now = Core.Std.Time.now () in
List.iter [ Pervasives.stdout ; Pervasives.stderr ] ~f:(fun oc ->
Core.Std.Printf.fprintf oc !"%s Daemonized with tags=%{Sexp}\n%!"
(Core.Std.Time.to_string_abs now ~zone:Core.Std.Time.Zone.local)
(Core.Std.Time.to_string_abs now ~zone:Core.Std.(force Time.Zone.local))
([%sexp_of: (string * string) list] tags)
))
);
Expand Down
2 changes: 2 additions & 0 deletions common/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module Clock_ns = struct end

include Stable_module_types

module Make_stable = Core.Stable.Make_stable

let concat = String.concat

let program_started_at = Time.now ()
Expand Down
2 changes: 1 addition & 1 deletion common/iron_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Make(T : sig type t [@@deriving of_sexp] end) = struct
env_var_has_been_read := true;
match Sys.getenv env_var with
| Some ("prod" | "PROD") -> prod ()
| Some s -> return (Sexp.of_string_conv_exn (String.strip s) [%of_sexp: T.t])
| Some s -> return (Sexp.of_string_conv_exn s [%of_sexp: T.t])
| None ->
if String.is_prefix Core.Std.Sys.executable_name ~prefix:"/j/office/app"
then prod ()
Expand Down
12 changes: 5 additions & 7 deletions common/iron_uuid.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ let length_of_string_repr =

module Stable = struct
module V1 = struct
include Wrap_stable.F
(Stable_format.V1)
(struct
type nonrec t = t
let to_stable = T.unshared_t
let of_stable = T.shared_t
end)
include Make_stable.Of_stable_format.V1 (Stable_format.V1) (struct
type nonrec t = t [@@deriving compare]
let to_stable_format = T.unshared_t
let of_stable_format = T.shared_t
end)

let%expect_test _ =
print_endline [%bin_digest: t];
Expand Down
12 changes: 5 additions & 7 deletions common/obligations_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ let hash t = Int.hash (to_int t)
module Stable = struct
module V1 = struct
let hash = hash
include Wrap_stable.F
(Stable_format.V1)
(struct
type nonrec t = t
let to_stable = to_int
let of_stable = of_int
end)
include Make_stable.Of_stable_format.V1 (Stable_format.V1) (struct
type nonrec t = t [@@deriving compare]
let to_stable_format = to_int
let of_stable_format = of_int
end)

let%expect_test _ =
print_endline [%bin_digest: t];
Expand Down
2 changes: 1 addition & 1 deletion common/query.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let create ?(by = User_name.unix_login) ?(at = Time.now ()) action =
; by
; at
; hostname
; machine_zone = Core.Std.Time.Zone.local
; machine_zone = Core.Std.(force Time.Zone.local)
; executable
; executable_version = Version_util.version
; action
Expand Down
52 changes: 23 additions & 29 deletions common/review_obligation.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
module Stable_format = struct

module Unstable = struct
module Symbolic_user_set = Symbolic_user_set
module User_name = User_name
end

module V1 = struct
open! Core.Stable
module Symbolic_user_set = Symbolic_user_set.Stable
Expand All @@ -26,7 +21,8 @@ module Stable_format = struct
end
end

open Core.Std
open! Core.Std
open! Import

module T = struct
type t =
Expand Down Expand Up @@ -398,29 +394,27 @@ let%test_module _ =
module Stable = struct
module V1 = struct
let hash = hash
include Wrap_stable.F
(Stable_format.V1)
(struct
type nonrec t = t

module V1 = Stable_format.V1

let rec to_stable : t -> V1.t = function
| All_of users -> All users
| At_least_wide (k, users) -> At_least_wide (k, users)
| And ts -> And (List.map ts ~f:to_stable)
| Or_wide ts -> Or_wide (List.map ts ~f:to_stable)
;;

let rec of_stable : V1.t -> t = fun v1 -> H.shared_t (aux v1)
and aux : V1.t -> t = function
| All users -> All_of users
| At_least_wide (k, users) -> At_least_wide (k, users)
| And ts -> And (List.map ts ~f:of_stable)
| Or_wide ts -> Or_wide (List.map ts ~f:of_stable)
| v1 -> failwiths "Review_obligation.of_stable" v1 [%sexp_of: V1.t]
;;
end)
include Make_stable.Of_stable_format.V1 (Stable_format.V1) (struct
type nonrec t = t [@@deriving compare]

module V1 = Stable_format.V1

let rec to_stable_format : t -> V1.t = function
| All_of users -> All users
| At_least_wide (k, users) -> At_least_wide (k, users)
| And ts -> And (List.map ts ~f:to_stable_format)
| Or_wide ts -> Or_wide (List.map ts ~f:to_stable_format)
;;

let rec of_stable_format : V1.t -> t = fun v1 -> H.shared_t (aux v1)
and aux : V1.t -> t = function
| All users -> All_of users
| At_least_wide (k, users) -> At_least_wide (k, users)
| And ts -> And (List.map ts ~f:of_stable_format)
| Or_wide ts -> Or_wide (List.map ts ~f:of_stable_format)
| v1 -> failwiths "Review_obligation.of_stable" v1 [%sexp_of: V1.t]
;;
end)

let%expect_test _ =
print_endline [%bin_digest: t];
Expand Down
2 changes: 0 additions & 2 deletions common/std.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ module Which_features = Which_features
module Which_session = Which_session
module Who_can_release_into_me = Who_can_release_into_me

module Wrap_stable = Wrap_stable.F

module type Persistent = Persistent.S

type 'a _or_pending = 'a Or_pending.t =
Expand Down
23 changes: 10 additions & 13 deletions common/symbolic_user_set.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,23 @@ end
open! Core.Std
open! Import

type t = User_name.Set.t [@@deriving sexp_of]
type t = User_name.Set.t [@@deriving compare, sexp_of]

let invariant _ = ()

module Stable = struct
module V1 = struct
include Wrap_stable.F
(Stable_format.V1)
(struct
type nonrec t = t
include Make_stable.Of_stable_format.V1 (Stable_format.V1) (struct
type nonrec t = t [@@deriving compare]

module V1 = Stable_format.V1
let to_stable_format t = Stable_format.V1.Users t

let to_stable t : V1.t = Users t

let of_stable : V1.t -> _ = function
| Users users -> users
| v1 -> failwiths "Symbolic_user_set.of_stable" v1 [%sexp_of: V1.t]
;;
end)
let of_stable_format = function
| Stable_format.V1.Users users -> users
| v1 ->
raise_s [%sexp "Symbolic_user_set.of_stable", (v1 : Stable_format.V1.t)]
;;
end)

let%expect_test _ =
print_endline [%bin_digest: t];
Expand Down
26 changes: 0 additions & 26 deletions common/wrap_stable.ml

This file was deleted.

10 changes: 0 additions & 10 deletions common/wrap_stable.mli

This file was deleted.

38 changes: 22 additions & 16 deletions hg/cr_soon_multiset.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Pre_stable = struct
open Import_stable
open! Import_stable

module Cr_soon = Cr_comment.Stable.Cr_soon

Expand All @@ -19,8 +19,8 @@ module Pre_stable = struct
end
end

open Core.Std
open Import
open! Core.Std
open! Import

module Cr_soon_in_feature = struct

Expand Down Expand Up @@ -69,8 +69,8 @@ module Cr_soon_in_feature = struct
;;
end

include Comparable.Make (T)
include Hashable. Make (T)
include Comparable.Make_plain (T)
include Hashable. Make_plain (T)

let rename_feature ({ cr_soon; feature_path } as t) ~from ~to_ =
if Feature_path.equal feature_path from
Expand All @@ -81,7 +81,7 @@ end

module Cr_soon_map = Cr_soon_in_feature.Map

type t = int Cr_soon_map.t [@@deriving sexp_of]
type t = int Cr_soon_map.t [@@deriving compare, sexp_of]

let invariant (t : t) : unit =
Map.iteri t ~f:(fun ~key:cr_soon ~data:count ->
Expand Down Expand Up @@ -178,15 +178,21 @@ module Stable = struct

include Pre_stable

module V1 =
Wrap_stable
(struct
type t = (Cr_soon_in_feature.V1.t * int) list [@@deriving bin_io, compare, sexp]
end)
(struct
type nonrec t = t
let of_stable = of_alist_exn
let to_stable x = to_alist x
end)
module V1 = struct
include Make_stable.Of_stable_format.V1
(struct
type t = (Cr_soon_in_feature.V1.t * int) list [@@deriving bin_io, sexp]
end)
(struct
type nonrec t = t [@@deriving compare]
let of_stable_format = of_alist_exn
let to_stable_format x = to_alist x
end)

let%expect_test _ =
print_endline [%bin_digest: t];
[%expect {| 6a97a4c3fe9fa833dcf1d598e874eea3 |}]
;;
end
;;
end
1 change: 1 addition & 0 deletions hg/hg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ module Tag = struct
module Stable = Stable.Tag

include Stable.Model
include Comparable.Make_plain(Stable.Model)

let to_string = Fn.id
let of_string = Fn.id
Expand Down
1 change: 1 addition & 0 deletions hg/hg.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ end
module Tag : sig
type t [@@deriving sexp_of]

include Comparable.S_plain with type t := t
include Stringable with type t := t

val is_nice_name : t -> for_tree_rooted_at:Feature_name.t -> bool
Expand Down
2 changes: 1 addition & 1 deletion hg/process_num_lines_in_diff4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let compute input =
(input_sexp, error)
[%sexp_of: Sexp.t * Error.t]
| Ok stdout ->
try Sexp.of_string_conv_exn (String.strip stdout) Reaction.t_of_sexp
try Sexp.of_string_conv_exn stdout Reaction.t_of_sexp
with exn ->
failwiths "line count process parse sexp error"
(input_sexp, stdout, exn)
Expand Down
4 changes: 2 additions & 2 deletions protocol/iron_versioned_rpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ module Make

let command_line_rpc () =
let%bind contents = Reader.file_contents "/dev/stdin" in
let action = Sexp.of_string_conv_exn (String.rstrip contents) [%of_sexp: action] in
let action = Sexp.of_string_conv_exn contents [%of_sexp: action] in
match%bind rpc_to_server action with
| Error error ->
eprintf "%s\n" (error |> [%sexp_of: Error.t] |> Sexp.to_string_hum);
Expand Down Expand Up @@ -397,7 +397,7 @@ module Make_pipe_rpc

let command_line_rpc () =
let%bind contents = Reader.file_contents "/dev/stdin" in
let action = Sexp.of_string_conv_exn (String.rstrip contents) [%of_sexp: action] in
let action = Sexp.of_string_conv_exn contents [%of_sexp: action] in
match%bind
Monitor.try_with_or_error ~extract_exn:true (fun () ->
let%bind pipe = rpc_to_server action in
Expand Down

0 comments on commit d923848

Please sign in to comment.