# # # patch "autocolor.ml" # from [7a11e879e6fa3d3ec1a812b1c2b3146ed8c14bf7] # to [f27c2d9e8720246e30948ab64095a38854b7b085] # # patch "autocolor.mli" # from [6380f588de9f3457c50c7d20846b6cc6a0d0efa9] # to [c8ade8687ec54d7852d55545e08f92b884f08120] # # patch "database.mli" # from [e625fe5288be50deeba869016d15b7a60a716da4] # to [5f231088c57966518dc227dc3e5e845edfff2a2c] # # patch "monotone.ml" # from [e1b68e6da8d6dd8a5afc6253f4187d63f463d402] # to [2287a8d5eba0e33d2c9744101b783c04269a04b4] # # patch "monotone.mli" # from [caa9158dd57c50f72973b68c33e2f00a6ef83ba0] # to [f6a7fc93b416ed251f8096bad2812c4157325dea] # # patch "query.ml" # from [1ba5f91fb7c65a662a9ae17af8a19edf6c318828] # to [718b3407f7a8d7e6537f686619567fea99f932c2] # # patch "view.ml" # from [dbc7bbd981a1cc9a1b399ea544cb4eaf10b62676] # to [7b1e9f8c8bfe323b136cd77aae6ff6c8853fe810] # # patch "viz_style.ml" # from [16b9d44d9f49fea0f4e4c6fff304ba88721833eb] # to [bd751840abc01136015889936c762dcc07a6200f] # # patch "viz_style.mli" # from [0ef255a1d99f080be0f2fceb5b35bb34f9dd7644] # to [39f0bf6b8542af069ba332237282b9eb42b873d2] # ============================================================ --- autocolor.ml 7a11e879e6fa3d3ec1a812b1c2b3146ed8c14bf7 +++ autocolor.ml f27c2d9e8720246e30948ab64095a38854b7b085 @@ -46,7 +46,7 @@ let white = 0xffffffffl let white = 0xffffffffl -let autocolor kind db = +let autocolor kind = let lookup_autocolor = Viz_misc.make_cache begin ============================================================ --- autocolor.mli 6380f588de9f3457c50c7d20846b6cc6a0d0efa9 +++ autocolor.mli c8ade8687ec54d7852d55545e08f92b884f08120 @@ -1,3 +1,3 @@ -val autocolor : Viz_types.autocolor -> Database.t -> (string list -> int32) +val autocolor : Viz_types.autocolor -> (string list -> int32) ============================================================ --- database.mli e625fe5288be50deeba869016d15b7a60a716da4 +++ database.mli 5f231088c57966518dc227dc3e5e845edfff2a2c @@ -12,8 +12,6 @@ val fetch_ancestry_graph : t -> query -> val get_filename : t -> string val fetch_ancestry_graph : t -> query -> agraph -val fetch_cert_signer : t -> string -> string -> string list -val fetch_cert_value : t -> string -> string -> string list val get_matching_tags : t -> (string -> bool) -> (string * string) list val get_matching_dates : t -> string -> (string * string) list ============================================================ --- monotone.ml e1b68e6da8d6dd8a5afc6253f4187d63f463d402 +++ monotone.ml 2287a8d5eba0e33d2c9744101b783c04269a04b4 @@ -66,3 +66,8 @@ let get_certs_and_revision mtn id = let get_certs_and_revision mtn id = certs mtn id +> _get_revision mtn id + +let cert_value mtn id name = + certs mtn id + +> List.find_all (fun c -> c.c_name = name) + +> List.map (fun c -> c.c_value) ============================================================ --- monotone.mli caa9158dd57c50f72973b68c33e2f00a6ef83ba0 +++ monotone.mli f6a7fc93b416ed251f8096bad2812c4157325dea @@ -7,3 +7,4 @@ val get_certs_and_revision : t -> string val branches : t -> (string * int) list val get_revision : t -> string -> Viz_types.node_data val get_certs_and_revision : t -> string -> Viz_types.node_data +val cert_value : t -> string -> string -> string list ============================================================ --- query.ml 1ba5f91fb7c65a662a9ae17af8a19edf6c318828 +++ query.ml 718b3407f7a8d7e6537f686619567fea99f932c2 @@ -108,9 +108,9 @@ let select_by_revision_content ctrl mtn (Agraph.get_ids g) -let expand_results db ids = +let expand_results mtn ids = let fetch_first_cert id c = - match Database.fetch_cert_value db id c with + match Monotone.cert_value mtn id c with | h :: _ -> h | [] -> "" in @@ -125,27 +125,25 @@ let do_query ~selector ~revision_content let do_query ~selector ~revision_content ctrl results_cb = let no_results () = results_cb (`IDS []) in - let results_ids db ids = - results_cb (`IDS (expand_results db ids)) in + let results_ids mtn ids = + results_cb (`IDS (expand_results mtn ids)) in - match ctrl#get_db, ctrl#get_agraph with - | Some db, Some g when selector <> "" -> + match ctrl#get_mtn, ctrl#get_agraph with + | Some mtn, Some g when selector <> "" -> Selector.select - ctrl db g selector + ctrl (some ctrl#get_db) g selector (function | `IDS ids when revision_content <> "" -> - let mtn = some ctrl#get_mtn in results_ids - db + mtn (filter_by_revision_content ctrl mtn revision_content ids) | `IDS ids -> - results_ids db ids + results_ids mtn ids | `SUB_PROC_ERROR _ as err -> results_cb err) - | Some db, Some g when revision_content <> "" -> - let mtn = some ctrl#get_mtn in - results_ids db + | Some mtn, Some g when revision_content <> "" -> + results_ids mtn (select_by_revision_content ctrl mtn revision_content g) | _ -> ============================================================ --- view.ml dbc7bbd981a1cc9a1b399ea544cb4eaf10b62676 +++ view.ml 7b1e9f8c8bfe323b136cd77aae6ff6c8853fe810 @@ -369,7 +369,7 @@ module Complete = struct | [] -> raise None | [ id ] -> begin - match Database.fetch_cert_value (some ctrl#get_db) id "date" with + match Monotone.cert_value (some ctrl#get_mtn) id "date" with | t :: _ -> t | [] -> raise None end @@ -799,8 +799,8 @@ module Branch_selector = struct s.entries.(1)#set_text "" | Some id -> match - Database.fetch_cert_value - (some ctrl#get_db) id "date" + Monotone.cert_value + (some ctrl#get_mtn) id "date" with | [] -> s.radio_buttons.(0)#set_active true @@ -868,10 +868,10 @@ module KeyNav = struct let navigate_is_sibling k id = List.exists (fun (i, _) -> i = id) k.keyboard_nav_siblings - let on_same_branch db id = - let b_target = Database.fetch_cert_value db id "branch" in + let on_same_branch mtn id = + let b_target = Monotone.cert_value mtn id "branch" in fun (id, _) -> - let b_node = Database.fetch_cert_value db id "branch" in + let b_node = Monotone.cert_value mtn id "branch" in List.exists (fun b -> List.mem b b_target) b_node @@ -889,7 +889,7 @@ module KeyNav = struct | `NEXT -> locate sx | `PREV -> locate (List.rev sx) | `PARENT | `CHILD -> - match List.filter (on_same_branch (some ctrl#get_db) current_id) sx with + match List.filter (on_same_branch (some ctrl#get_mtn) current_id) sx with | [] -> Some (List.hd sx) | h :: _ -> Some h @@ -1165,7 +1165,7 @@ module Canvas = struct let canvas = c.canvas in let graph = some ctrl#get_agraph in let layout = Agraph.get_layout graph in - let db = some ctrl#get_db in + let mtn = some ctrl#get_mtn in let pr = ctrl#status "canvas" in let prefs = ctrl#get_prefs in let lr_layout = prefs.Viz_style.lr_layout in @@ -1213,7 +1213,7 @@ module Canvas = struct let font = prefs.Viz_style.font in let font_size = get_font_size font in - let match_style = Viz_style.match_style prefs graph db in + let match_style = Viz_style.match_style prefs graph mtn in let node_item id node () = let g = GnoCanvas.group ~x:node.n_x ~y:node.n_y nodes_group in @@ -1265,7 +1265,7 @@ module Canvas = struct false end | `TWO_BUTTON_PRESS b when is_neighbor node && GdkEvent.Button.button b = 1 -> begin - match Database.fetch_cert_value db id "branch" with + match Monotone.cert_value mtn id "branch" with | other_branch :: _ -> ctrl#switch_branch (other_branch, id) | [] -> () ============================================================ --- viz_style.ml 16b9d44d9f49fea0f4e4c6fff304ba88721833eb +++ viz_style.ml bd751840abc01136015889936c762dcc07a6200f @@ -93,11 +93,11 @@ type text_props = [ | `FONT of string | `WEIGHT of int] -let match_style { autocolor = autocolor_pref ; style = style } g db = - let autocolor = Autocolor.autocolor autocolor_pref db in +let match_style { autocolor = autocolor_pref ; style = style } g mtn = + let autocolor = Autocolor.autocolor autocolor_pref in fun id (default_rect_props, default_txt_props) -> - let get_cert n = Database.fetch_cert_value db id n in + let get_cert n = Monotone.cert_value mtn id n in let matching_attrs = List.fold_left @@ -152,8 +152,8 @@ let match_style { autocolor = autocolor_ else begin let autocolor_key = match autocolor_pref with - | BY_AUTHOR_HASH -> Database.fetch_cert_value db id "author" - | BY_BRANCH_HASH -> Database.fetch_cert_value db id "branch" + | BY_AUTHOR_HASH -> Monotone.cert_value mtn id "author" + | BY_BRANCH_HASH -> Monotone.cert_value mtn id "branch" | NONE -> [] in `FILL_COLOR_RGBA (autocolor autocolor_key) :: cleanup_rect_props end in ============================================================ --- viz_style.mli 0ef255a1d99f080be0f2fceb5b35bb34f9dd7644 +++ viz_style.mli 39f0bf6b8542af069ba332237282b9eb42b873d2 @@ -28,7 +28,7 @@ val match_style : val match_style : prefs -> Agraph.t -> - Database.t -> + Monotone.t -> string -> shape_props list * text_props list -> [> shape_props | `FILL_COLOR_RGBA of int32] list * [> text_props] list