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.

fix squash command messages

+30 -12
+10 -6
jj_tui/bin/graph_view.ml
··· 68 68 ; cmd = 69 69 Fun 70 70 (fun _ -> 71 - let curr_msg, prev_msg = get_messages () in 72 - let new_msg = prev_msg ^ curr_msg in 73 71 let rev = Vars.get_selected_rev () in 72 + let source_msg, dest_msg = get_messages rev (rev ^ "-") in 73 + let new_msg = 74 + [ dest_msg;source_msg ] |> String.concat_non_empty "\n" 75 + in 74 76 jj [ "squash"; "--quiet"; "-r"; rev; "-m"; new_msg ] |> ignore) 75 77 } 76 78 ; { ··· 79 81 ; cmd = 80 82 PromptThen 81 83 ( "target revision" 82 - , fun str -> 83 - let curr_msg, prev_msg = get_messages () in 84 - let new_msg = prev_msg ^ curr_msg in 84 + , fun target -> 85 85 Dynamic_r 86 86 (fun rev -> 87 + let src_msg, dest_msg = get_messages rev target in 88 + let new_msg = 89 + [ dest_msg;src_msg ] |> String.concat_non_empty "\n" 90 + in 87 91 Cmd 88 92 [ 89 93 "squash" ··· 93 97 ; "--from" 94 98 ; rev 95 99 ; "--into" 96 - ; str 100 + ; target 97 101 ]) ) 98 102 } 99 103 ; {
+10 -6
jj_tui/bin/jj_process.ml
··· 110 110 ;; 111 111 112 112 (**gets the description of the current and previous change. Useful when squashing*) 113 - let get_messages () = 113 + let get_messages source dest = 114 114 let open Base.Result in 115 115 let output = 116 116 jj ··· 118 118 "log" 119 119 ; "--no-graph" 120 120 ; "-T" 121 - ; {|"::"++current_working_copy++"::\n"++description++"\n::end::\n"|} 121 + ; Printf.sprintf 122 + {|if(self.contained_in("%s")||self.contained_in("%s"),description++"%s")++if(self.contained_in("%s")||self.contained_in("%s"),description)|} 123 + source 124 + source 125 + "\u{ab}" 126 + dest 127 + dest 122 128 ] 123 129 |> String.trim 124 130 in 125 - let current, prev = 126 - output |> Jj_tui.OutputParsing.parse_descriptions |> Result.get_ok 127 - in 128 - current |> String.concat "", prev |> String.concat "" 131 + let source, dest = output |> Base.String.lsplit2_exn ~on:'\xab' in 132 + Base.String.drop_suffix source 1, dest 129 133 ;; 130 134 131 135 open Vars
+10
jj_tui/lib/util.ml
··· 29 29 ;; 30 30 31 31 Base.List.intersperse 32 + 32 33 let ( <-$ ) f v = Lwd.map ~f (Lwd.get v) 33 34 let ( $-> ) v f = Lwd.map ~f (Lwd.get v) 34 35 let ( let$$ ) v f = Lwd.map ~f (Lwd.get v) ··· 36 37 let ( >> ) f g x = g (f x) 37 38 let ( << ) f g x = f (g x) 38 39 let ( |>$$ ) v2 v f = Lwd.map2 ~f v v2 40 + 41 + module String = struct 42 + include String 43 + 44 + (** Concatenates any non-empty strings in the given array*) 45 + let concat_non_empty sep strings = 46 + strings |> List.filter (Base.String.is_empty >> not) |> String.concat sep 47 + ;; 48 + end