Use custom labels for the diffs #9

Merged
reynir merged 1 commit from diff-labels into main 2025-01-10 11:34:13 +00:00

View file

@ -195,6 +195,11 @@ let detailed_opam_diff pkg l r =
(no_build_install_url l) (no_build_install_url r) (no_build_install_url l) (no_build_install_url r)
in in
let diff = let diff =
let label_l =
Printf.sprintf "left/%s/opam" (OpamPackage.name_to_string pkg)
and label_r =
Printf.sprintf "left/%s/opam" (OpamPackage.name_to_string pkg)
in
try try
Bos.OS.File.with_tmp_oc "opaml_%s" Bos.OS.File.with_tmp_oc "opaml_%s"
(fun pl oc () -> (fun pl oc () ->
@ -204,7 +209,10 @@ let detailed_opam_diff pkg l r =
(fun pr oc () -> (fun pr oc () ->
Out_channel.output_string oc opamr; Out_channel.output_string oc opamr;
Out_channel.close oc; Out_channel.close oc;
let cmd = Bos.Cmd.(v "diff" % "-u" % p pl % p pr) in let cmd =
Bos.Cmd.(v "diff" % "-u" % "--label" % label_l % "--label" % label_r %
p pl % p pr)
in
Bos.OS.Cmd.(run_out cmd |> out_string)) Bos.OS.Cmd.(run_out cmd |> out_string))
()) ())
() ()