3-way merge with Myers diff
0
fork

Configure Feed

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

mass replace Printf.sprintf/printf with Fmt.str/pr (merlint E200)

112 files across the monorepo. Printf.sprintf → Fmt.str,
Printf.printf → Fmt.pr for consistent formatting library usage.

+11 -11
+4 -4
bench/bench.ml
··· 55 55 let arr = Array.copy base in 56 56 for _ = 1 to ops do 57 57 let idx = Random.State.int rng (Array.length arr) in 58 - arr.(idx) <- Printf.sprintf "edited %d" (Random.State.int rng 1000000) 58 + arr.(idx) <- Fmt.str "edited %d" (Random.State.int rng 1000000) 59 59 done; 60 60 arr 61 61 ··· 83 83 let base = join base_lines in 84 84 let ours = join (edit_lines ~seed:(seed + 1) ~ops:edits_n base_lines) in 85 85 let theirs = join (edit_lines ~seed:(seed + 2) ~ops:edits_n base_lines) in 86 - Printf.printf "Files: %d lines, %d edits/side, %d runs\n" lines_n edits_n runs; 86 + Fmt.pr "Files: %d lines, %d edits/side, %d runs\n" lines_n edits_n runs; 87 87 let t0 = Unix.gettimeofday () in 88 88 for _ = 1 to runs do 89 89 let chunks = Merge3.merge ~base ~ours ~theirs () in ··· 91 91 () 92 92 done; 93 93 let elapsed = Unix.gettimeofday () -. t0 in 94 - Printf.printf "Total: %.3fs (%.3fs/merge)\n" elapsed 94 + Fmt.pr "Total: %.3fs (%.3fs/merge)\n" elapsed 95 95 (elapsed /. float_of_int runs); 96 - Printf.printf "Throughput: %.0f merges/s\n" (float_of_int runs /. elapsed) 96 + Fmt.pr "Throughput: %.0f merges/s\n" (float_of_int runs /. elapsed)
+7 -7
test/interop/git/test.ml
··· 19 19 20 20 let tmp_dir = 21 21 let d = Filename.temp_dir "merge3-interop-git" "" in 22 - at_exit (fun () -> ignore (Sys.command (Printf.sprintf "rm -rf %s" d))); 22 + at_exit (fun () -> ignore (Sys.command (Fmt.str "rm -rf %s" d))); 23 23 d 24 24 25 25 let counter = ref 0 ··· 27 27 let write_tmp content = 28 28 let n = !counter in 29 29 incr counter; 30 - let path = Filename.concat tmp_dir (Printf.sprintf "f%d" n) in 30 + let path = Filename.concat tmp_dir (Fmt.str "f%d" n) in 31 31 let oc = open_out path in 32 32 output_string oc content; 33 33 close_out oc; ··· 41 41 let ours_path = write_tmp ours in 42 42 let theirs_path = write_tmp theirs in 43 43 let cmd = 44 - Printf.sprintf "git merge-file -L %s -L base -L %s -p %s %s %s 2>/dev/null" 44 + Fmt.str "git merge-file -L %s -L base -L %s -p %s %s %s 2>/dev/null" 45 45 (Filename.quote ours_label) 46 46 (Filename.quote theirs_label) 47 47 (Filename.quote ours_path) (Filename.quote base_path) ··· 181 181 let ours = 182 182 "let add x y =\n\ 183 183 \ (* with logging *)\n\ 184 - \ Printf.printf \"adding\";\n\ 184 + \ Fmt.pr \"adding\";\n\ 185 185 \ x + y\n\ 186 186 let sub x y = x - y\n\ 187 187 let mul x y = x * y\n" ··· 253 253 for _ = 1 to ops do 254 254 let len = List.length !lines in 255 255 if len = 0 then 256 - lines := [ Printf.sprintf "new line %d" (Random.State.int rng 1000) ] 256 + lines := [ Fmt.str "new line %d" (Random.State.int rng 1000) ] 257 257 else 258 258 let idx = Random.State.int rng len in 259 259 let op = Random.State.int rng 3 in ··· 264 264 List.mapi 265 265 (fun i l -> 266 266 if i = idx then 267 - Printf.sprintf "edited %d" (Random.State.int rng 1000) 267 + Fmt.str "edited %d" (Random.State.int rng 1000) 268 268 else l) 269 269 !lines 270 270 | 1 -> 271 271 (* insert *) 272 272 let new_l = 273 - Printf.sprintf "inserted %d" (Random.State.int rng 1000) 273 + Fmt.str "inserted %d" (Random.State.int rng 1000) 274 274 in 275 275 let rec ins i = function 276 276 | [] -> [ new_l ]