2 * Copyright (c) 2018, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
10 type load_state_error
=
11 (* an error reported by mk_state_future for downloading saved-state *)
12 | Load_state_loader_failure
of State_loader.error
13 (* an error fetching list of dirty files from hg *)
14 | Load_state_dirty_files_failure
of Future.error
15 (* either the downloader or hg-dirty-files took too long *)
17 (* any other unhandled exception from lazy_init *)
18 | Load_state_unhandled_exception
of {exn
: exn
; stack
: Utils.callstack
;}
20 type load_state_approach
=
21 | Precomputed
of ServerArgs.saved_state_target_info
22 | Load_state_natively
of bool
23 | Load_state_natively_with_target
of ServerMonitorUtils.target_saved_state
28 | Saved_state_init
of load_state_approach
30 (** Docs are in .mli *)
32 | Load_state_succeeded
of int option
33 | Load_state_failed
of string
34 | Load_state_declined
of string
36 (** returns human-readable string, an indication of whether auto-retry is sensible, and stack *)
37 let load_state_error_to_verbose_string (err
: load_state_error
) : string * bool * Utils.callstack
=
39 | Load_state_loader_failure err
->
40 State_loader.error_string_verbose err
41 | Load_state_dirty_files_failure error
->
42 let (msg
, stack
) = Future.error_to_string_verbose error
in
43 Printf.sprintf
"Problem getting dirty files from hg: %s" msg
, false, stack
44 | Load_state_timeout
->
45 "Timed out trying to load state", false, Utils.Callstack
""
46 | Load_state_unhandled_exception
{exn
; stack
;} ->
47 Printf.sprintf
"Unexpected bug loading saved state - %s" (Printexc.to_string exn
), false, stack
49 type files_changed_while_parsing
= Relative_path.Set.t
53 saved_state_fn
: string;
55 corresponding_rev
: Hg.rev
;
56 mergebase_rev
: Hg.global_rev
option;
57 (* Files changed between saved state revision and current public merge base *)
58 dirty_master_files
: Relative_path.Set.t
;
59 (* Files changed between public merge base and current revision *)
60 dirty_local_files
: Relative_path.Set.t
;
61 old_naming_table
: Naming_table.t
;
62 old_errors
: SaveStateServiceTypes.saved_state_errors
;
63 state_distance
: int option;
67 type lazy_level
= Off
| Decl
| Parse
| Init