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.

support deleting branches

renamed git_push to git_push_hovered and added new
git_push_all that can push deletion

+84 -41
+66 -18
jj_tui/bin/graph_commands.ml
··· 14 14 open Process 15 15 open Jj_tui.Process_wrappers.Make (Process) 16 16 open Jj_tui.Key_map 17 + 17 18 (* Helper functions from graph_view *) 18 19 let bookmark_select_prompt get_bookmark_list name func = 19 20 Selection_prompt ··· 22 23 , (fun x bookmark_name -> bookmark_name |> Base.String.is_substring ~substring:x) 23 24 , func ) 24 25 ;; 26 + 25 27 let remote_select_prompt name func = 26 28 Selection_prompt 27 29 ( name ··· 48 50 let rev_args = List.concat_map (fun r -> [ "-r"; r ]) revs in 49 51 let title = Printf.sprintf "Git push (%s) will:" remote in 50 52 let dry_run_cmd = 51 - [ "git"; "push"; "--allow-new"; "--dry-run"; "--remote"; remote ] @ rev_args 53 + [ "git"; "push"; "--allow-new"; "--dry-run"; "--remote"; remote ] 54 + @ rev_args 52 55 in 53 56 let real_cmd = 54 57 Cmd_async 55 58 ( "pushing to remote..." 56 - , [ "git"; "push"; "--allow-new"; "--remote"; remote ] @ rev_args ) 59 + , [ "git"; "push"; "--allow-new"; "--remote"; remote ] 60 + @ rev_args ) 61 + in 62 + confirm_dry_run_prompt ~title ~dry_run_cmd ~real_cmd) 63 + in 64 + let push_all_cmd () = 65 + Dynamic 66 + (fun () -> 67 + let title = Printf.sprintf "Git push (%s) will:" remote in 68 + let dry_run_cmd = 69 + [ "git"; "push";"--deleted"; "--allow-new"; "--dry-run"; "--remote"; remote ] 70 + 71 + in 72 + let real_cmd = 73 + Cmd_async 74 + ( "pushing to remote..." 75 + , [ "git"; "push"; "--allow-new"; "--deleted"; "--remote"; remote ] 76 + ) 57 77 in 58 78 confirm_dry_run_prompt ~title ~dry_run_cmd ~real_cmd) 59 79 in ··· 63 83 in 64 84 Key_Map.of_seq 65 85 @@ List.to_seq 66 - [ ( Key.key_of_string_exn "p" 67 - , { key = Key.key_of_string_exn "p" 86 + [ 87 + ( Key.key_of_string_exn "p" 88 + , { 89 + key = Key.key_of_string_exn "p" 68 90 ; sort_key = 0. 69 - ; description = Printf.sprintf "git push to %s" remote 91 + ; description = Printf.sprintf "git push hovered to %s" remote 70 92 ; cmd = push_cmd () 93 + } ); 94 + ( Key.key_of_string_exn "P" 95 + , { 96 + key = Key.key_of_string_exn "P" 97 + ; sort_key = 0.1 98 + ; description = Printf.sprintf "git push all to %s" remote 99 + ; cmd = push_all_cmd() 71 100 } ) 72 101 ; ( Key.key_of_string_exn "f" 73 - , { key = Key.key_of_string_exn "f" 102 + , { 103 + key = Key.key_of_string_exn "f" 74 104 ; sort_key = 1. 75 105 ; description = Printf.sprintf "git fetch from %s" remote 76 106 ; cmd = fetch_cmd 77 107 } ) 78 108 ] 109 + ;; 79 110 80 111 (* Define all graph commands *) 81 112 let get_command_registry get_commands = ··· 314 345 ("Dest rev for bookmark including " ^ rev, [ "rebase"; "-b"; rev; "-d" ]))) 315 346 } 316 347 ; { 317 - id = "git_push" 348 + id = "git_push_hovered" 318 349 ; sorting_key = 23.0 319 - ; description = "git push" 350 + ; description = "git push hovered branch (use push all to delete)" 320 351 ; make_cmd = 321 352 (fun () -> 322 353 Dynamic ··· 325 356 let rev_args = revs |> List.concat_map (fun x -> [ "-r"; x ]) in 326 357 let title = "Git push will:" in 327 358 let dry_run_cmd = 328 - [ "git"; "push"; "--allow-new"; "--dry-run" ] @ rev_args 359 + [ "git"; "push"; "--allow-new"; "--dry-run" ] @ rev_args 329 360 in 330 361 let real_cmd = 331 362 Cmd_async 332 363 ( "pushing to remote..." 333 - , [ "git"; "push"; "--allow-new" ] @ rev_args ) 364 + , [ "git"; "push"; "--allow-new" ] @ rev_args ) 365 + in 366 + confirm_dry_run_prompt ~title ~dry_run_cmd ~real_cmd)) 367 + } 368 + ; { 369 + id = "git_push_all" 370 + ; sorting_key = 23.0 371 + ; description = "git push all branches" 372 + ; make_cmd = 373 + (fun () -> 374 + Dynamic 375 + (fun () -> 376 + let title = "Git push will:" in 377 + let dry_run_cmd = 378 + [ "git"; "push"; "--deleted"; "--allow-new"; "--dry-run" ] 379 + in 380 + let real_cmd = 381 + Cmd_async 382 + ( "pushing to remote..." 383 + , [ "git"; "push"; "--deleted"; "--allow-new" ] ) 334 384 in 335 385 confirm_dry_run_prompt ~title ~dry_run_cmd ~real_cmd)) 336 386 } ··· 338 388 id = "git_fetch" 339 389 ; sorting_key = 24.0 340 390 ; description = "git fetch" 341 - ; make_cmd = 342 - (fun () -> Cmd_async ("fetching from remote...", [ "git"; "fetch" ])) 391 + ; make_cmd = (fun () -> Cmd_async ("fetching from remote...", [ "git"; "fetch" ])) 343 392 } 344 393 ; { 345 394 id = "git_fetch_all" ··· 349 398 (fun () -> 350 399 Cmd_async ("fetching all remotes...", [ "git"; "fetch"; "--all-remotes" ])) 351 400 } 352 - ; { 401 + ; { 353 402 id = "git_remote_menu" 354 403 ; sorting_key = 25.5 355 404 ; description = "Select remote, then run git commands" 356 - ; make_cmd = (fun () -> 357 - remote_select_prompt 358 - "Select remote" 359 - (fun remote -> SubCmd (make_remote_git_submenu remote))) 405 + ; make_cmd = 406 + (fun () -> 407 + remote_select_prompt "Select remote" (fun remote -> 408 + SubCmd (make_remote_git_submenu remote))) 360 409 } 361 410 ; { 362 411 id = "parallelize" ··· 501 550 parent that modified that file" 502 551 ; make_cmd = (fun () -> Dynamic_r (fun r -> Cmd [ "absorb"; "--from"; r ])) 503 552 } 504 - 505 553 ] 506 554 |> List.to_seq 507 555 |> Seq.map (fun x -> x.id, x)
+18 -23
jj_tui/lib/key_map.ml
··· 62 62 end) = 63 63 struct 64 64 type t = Item.t Key_Map.t [@@deriving show] 65 - type t_update_t = t 65 + type t_update_t = t 66 66 67 67 let of_yaml (yaml : Yaml.value) = 68 68 match yaml with ··· 87 87 let rec to_yaml (key_map : Item.t Key_Map.t) : Yaml.value = 88 88 obj (key_map |> Key_Map.to_seq |> Seq.map (Item.to_yaml to_yaml) |> List.of_seq) 89 89 ;; 90 - let t_update_t_to_yaml (key_map : t) : Yaml.value = 91 - to_yaml key_map 92 - ;; 93 - 90 + 91 + let t_update_t_to_yaml (key_map : t) : Yaml.value = to_yaml key_map 94 92 let t_update_t_of_yaml (yaml : Yaml.value) = of_yaml yaml 95 93 96 94 (**Merge two key maps, checking for duplicate keys*) 97 - let t_apply_update override og = 98 - Key_Map.merge 99 - (fun k v1 v2 -> 100 - match v1, v2 with 101 - | Some og, Some override -> 102 - Some override 103 - | Some v, None | None, Some v -> 104 - Some v 105 - | None, None -> 106 - None) 107 - og 108 - override 109 - ;; 95 + let t_apply_update override og = 96 + Key_Map.merge 97 + (fun k v1 v2 -> 98 + match v1, v2 with 99 + | Some og, Some override -> 100 + Some override 101 + | Some v, None | None, Some v -> 102 + Some v 103 + | None, None -> 104 + None) 105 + og 106 + override 107 + ;; 110 108 end 111 109 112 110 type command = { command : string } [@@deriving show] ··· 196 194 let of_yaml = remap_key_map_item_of_yaml 197 195 let to_yaml = remap_key_map_item_to_yaml 198 196 end) 199 - 200 - 201 197 202 198 (* let rec key_map_merge (key_map1 : key_map) (key_map2 : key_map) : key_map = 203 199 let merged = Key_Map.create (Key_Map.length key_map1 + Key_Map.length key_map2) in ··· 221 217 merged 222 218 ;; *) 223 219 224 - 225 - 226 220 let cmd key id = 227 221 let key = Key.key_of_string_exn key in 228 222 key, Command { command = id } ··· 305 299 "g" 306 300 "Git" 307 301 [ 308 - cmd "p" "git_push" 302 + cmd "p" "git_push_hovered" 303 + ; cmd "P" "git_push_all" 309 304 ; cmd "f" "git_fetch" 310 305 ; cmd "F" "git_fetch_all" 311 306 ; cmd "r" "git_remote_menu"