terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

+48 -38
+6
design.md
··· 1 + # Rendering of current status: 2 + - Should use some kind of mailbox processor 3 + - When it gets triggered, it checks the current status and runs jj to fill the various buffers with the latest graph and such 4 + - Should have a cache that gets invalidated whenever jj says there was a change 5 + - The cache can store the fully processed data for the view buffers 6 + iiee
+15 -18
jj_tui/bin/file_view.ml
··· 100 100 |> List.map (fun (_modifier, file) -> 101 101 W.Lists.{ data = file; ui = W.Lists.selectable_item (W.string file) }) 102 102 in 103 - let show_diff_promise = ref @@ Promise.of_value () in 104 - (*TODO: 105 - This should be redesigned completely 106 - There will be a new function that renders the show state 107 - It will have a cancellation system just like this one. 108 - when any of the dependencies change, selected file, selected rev, focus etc, it will re-render if needed and cancel the current rendering. 109 - 110 - 103 + (*TODO: 104 + This should be redesigned completely 105 + There will be a new function that renders the show state 106 + It will have a cancellation system just like this one. 107 + when any of the dependencies change, selected file, selected rev, focus etc, it will re-render if needed and cancel the current rendering. 111 108 *) 112 - let show_selected_file_diff ()= 109 + let show_selected_file_diff () = 113 110 (* kill any existing process writing to the show buffer*) 114 - !show_diff_promise |> Promise.terminate; 111 + !(Vars.ui_state.jj_show_promise) |> Promise.terminate; 115 112 (* set self as current process writing to show buffer*) 116 - show_diff_promise 113 + Vars.ui_state.jj_show_promise 117 114 := Picos_std_structured.Flock.fork_as_promise (fun () -> 118 115 let rev = Vars.get_selected_rev () in 119 116 let selected = Lwd.peek selected_file in 120 117 Vars.ui_state.jj_show 121 118 $= 122 119 if selected != "" 123 - then 124 - let log=jj_no_log [ "diff"; "-r"; rev; selected ] in 125 - Control.yield(); 126 - let res=log|> AnsiReverse.colored_string in 127 - Control.yield(); 128 - res 120 + then ( 121 + let log = jj_no_log [ "diff"; "-r"; rev; selected ] in 122 + Control.yield (); 123 + let res = log |> AnsiReverse.colored_string in 124 + Control.yield (); 125 + res) 129 126 else I.string A.empty "") 130 127 in 131 128 W.Lists.selection_list_custom 132 129 ~on_selection_change:(fun selected -> 133 130 Lwd.set selected_file selected; 134 - if Focus.peek_has_focus focus then show_selected_file_diff()) 131 + if Focus.peek_has_focus focus then show_selected_file_diff ()) 135 132 ~custom_handler:(fun _ key -> 136 133 match key with `ASCII k, [] -> handleInputs command_mapping k | _ -> `Unhandled) 137 134 file_uis
+11 -6
jj_tui/bin/global_funcs.ml
··· 46 46 (* From now on we use ignore-working-copy so we don't re-snapshot the state and so 47 47 we can operate in paralell *) 48 48 (* TODO: stop using dop last twice *) 49 - let log_res = 50 - Flock.fork_as_promise (fun _ -> 51 - jj_no_log ~snapshot:false [ "show"; "-s"; "--color-words"; "-r"; rev ] 52 - |> colored_string) 49 + let _= 50 + (* TODO: could these all just run in fully paralell like this ?*) 51 + !(Vars.ui_state.jj_show_promise) |> Promise.terminate; 52 + Vars.ui_state.jj_show_promise 53 + := Flock.fork_as_promise @@ fun () -> 54 + let show_data = 55 + jj_no_log ~snapshot:false [ "show"; "-s"; "--color-words"; "-r"; rev ] 56 + |> colored_string 57 + in 58 + Vars.ui_state.jj_show $= show_data 53 59 and branches = 54 60 Flock.fork_as_promise (fun _ -> 55 61 jj_no_log ~snapshot:false [ "branch"; "list"; "-a" ] |> colored_string) 56 62 and files_list = Flock.fork_as_promise (fun _ -> list_files ~rev ()) in 57 63 (*wait for all our tasks*) 58 - let log_res= Promise.await log_res 59 - and files_list = Promise.await files_list 64 + let files_list = Promise.await files_list 60 65 and branches = Promise.await branches in 61 66 (*now we can assign our results*) 62 67 (* Vars.ui_state.jj_show $= log_res; *)
+12 -9
jj_tui/bin/global_vars.ml
··· 1 1 open Notty 2 2 open Nottui 3 3 open Eio.Std 4 + open Picos_std_structured 4 5 open Lwd_infix 5 6 open Jj_tui.Process 6 7 ··· 18 19 ; input : [ `Normal | `Mode of char -> Ui.may_handle ] Lwd.var 19 20 ; show_popup : (ui Lwd.t * string) option Lwd.var 20 21 ; show_prompt : W.Overlay.text_prompt_data option Lwd.var 21 - (* ; show_graph_selection_prompt : *) 22 + (* ; show_graph_selection_prompt : *) 22 23 (* rev_id maybe_unique W.Overlay.filterable_selection_list_prompt_data option Lwd.var *) 23 24 ; show_string_selection_prompt : 24 25 string W.Overlay.filterable_selection_list_prompt_data option Lwd.var ··· 26 27 ; command_log : string list Lwd.var 27 28 ; jj_tree : I.t Lwd.var 28 29 ; jj_show : I.t Lwd.var 30 + ; jj_show_promise : (unit Promise.t) ref 29 31 ; jj_branches : I.t Lwd.var 30 32 ; jj_change_files : (string * string) list Lwd.var 31 33 ; selected_revision : rev_id maybe_unique Lwd.var 32 34 ; revset : string option Lwd.var 33 35 ; trigger_update : unit Lwd.var 34 36 } 35 - let get_unique_id maybe_unique_rev = 36 - match maybe_unique_rev with 37 - | Unique { change_id; _ } -> 38 - change_id 39 - | Duplicate { commit_id; _ } -> 40 - commit_id 41 - ;; 37 + 38 + let get_unique_id maybe_unique_rev = 39 + match maybe_unique_rev with 40 + | Unique { change_id; _ } -> 41 + change_id 42 + | Duplicate { commit_id; _ } -> 43 + commit_id 44 + ;; 42 45 43 46 (** Global variables for the ui. Here we keep anything that's just a pain to pipe around*) 44 47 module type Vars = sig ··· 82 85 view = Lwd.var `Main 83 86 ; jj_tree = Lwd.var I.empty 84 87 ; jj_show = Lwd.var I.empty 88 + ; jj_show_promise = ref @@ Promise.of_value () 85 89 ; jj_branches = Lwd.var I.empty 86 90 ; jj_change_files = Lwd.var [] 87 91 ; selected_revision = Lwd.var (Unique { change_id = "@"; commit_id = "@" }) ··· 115 119 let get_eio_env () = (Option.get !eio).env 116 120 let get_eio_vars () = Option.get !eio 117 121 let get_term () = Option.get !term 118 - 119 122 120 123 (**Gets an id for the selected revision. If the change_id is unique we use that, if it's not we return a commit_id instead*) 121 124 let get_selected_rev () = Lwd.peek ui_state.selected_revision |> get_unique_id
+4 -5
jj_tui/bin/graph_view.ml
··· 7 7 open! Jj_tui.Util 8 8 open Jj_commands.Make (Vars) 9 9 open Jj_widgets.Make (Vars) 10 - module Process =Jj_process.Make (Vars) 10 + module Process = Jj_process.Make (Vars) 11 11 open Process 12 - open Jj_tui.Process_wrappers.Make(Process) 12 + open Jj_tui.Process_wrappers.Make (Process) 13 13 14 14 let branch_select_prompt get_branch_list name func = 15 15 Selection_prompt ··· 348 348 349 349 (*TODO:make a custom widget the renders the commit with and without selection. 350 350 with selection replace the dot with a blue version and slightly blue tint the background *) 351 - let graph_view () = 351 + let graph_view ()= 352 352 (*We have a seperate error var here instead of using a result type. This allows us to avoid using Lwd.bind which would cause our list selection to get reset anytime the content changes *) 353 353 let error_var = Lwd.var None in 354 354 let revset_ui = ··· 418 418 (* Eio.Fiber.fork ~sw @@ fun _ -> *) 419 419 (* Vars.update_ui_state @@ fun _ -> *) 420 420 (* TODO: Do i need this now that we have the concurrency safeguards?*) 421 - Picos_std_structured.Flock.fork(fun ()-> 422 421 Lwd.set Vars.ui_state.selected_revision revision; 423 - Global_funcs.update_views ())) 422 + Picos_std_structured.Flock.fork (fun () -> Global_funcs.update_views ())) 424 423 ~custom_handler:(fun _ key -> handleKeys key) 425 424 in 426 425 let final_ui =