Change invariant to compute differential of reports

Reviewed By: jeremydubreil

Differential Revision: D5031092

fbshipit-source-id: f762179
master
Martino Luca 8 years ago committed by Facebook Github Bot
parent 30bcc6b5ce
commit 6d1d78bb60

@ -521,14 +521,18 @@ let infer_mode () =
clean_results_dir () clean_results_dir ()
let differential_mode () = let differential_mode () =
let arg_or_fail arg_name arg_opt = (* at least one report must be passed in input to compute differential *)
match arg_opt with (match Config.report_current, Config.report_previous with
| Some arg -> arg | None, None ->
| None -> failwithf "Expected '%s' argument not found" arg_name in failwith "Expected at least one argument among 'report-current' and 'report-previous'\n"
let load_report filename : Jsonbug_t.report = | _ -> ());
Jsonbug_j.report_of_string (In_channel.read_all filename) in let load_report filename_opt : Jsonbug_t.report =
let current_report = load_report (arg_or_fail "report-current" Config.report_current) in let empty_report = [] in
let previous_report = load_report (arg_or_fail "report-previous" Config.report_previous) in Option.value_map
~f:(fun filename -> Jsonbug_j.report_of_string (In_channel.read_all filename))
~default:empty_report filename_opt in
let current_report = load_report Config.report_current in
let previous_report = load_report Config.report_previous in
let file_renamings = match Config.file_renamings with let file_renamings = match Config.file_renamings with
| Some f -> DifferentialFilters.FileRenamings.from_json_file f | Some f -> DifferentialFilters.FileRenamings.from_json_file f
| None -> DifferentialFilters.FileRenamings.empty in | None -> DifferentialFilters.FileRenamings.empty in

Loading…
Cancel
Save