Monorepo management for opam overlays
0
fork

Configure Feed

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

Thread ~sw through monopam to fix Switch finished! bug

Pass Eio switch from top-level Eio_main.run down to all
Git.Repository.open_repo calls instead of creating tiny
per-call Switch.run scopes that close prematurely.

+28 -23
+2 -2
bin/cmd_status.ml
··· 74 74 unregistered 75 75 end 76 76 77 - let print_forks ~proc ~fs ~config ~show_all = 77 + let print_forks ~sw ~proc ~fs ~config ~show_all = 78 78 match Monopam.Verse_config.load ~fs () with 79 79 | Error _ -> () 80 80 | Ok verse_config -> ··· 123 123 "(opam changed)") 124 124 pub.unpublished 125 125 end; 126 - if show_forks then print_forks ~proc ~fs ~config ~show_all; 126 + if show_forks then print_forks ~sw ~proc ~fs ~config ~show_all; 127 127 `Ok () 128 128 | Error e -> 129 129 Fmt.epr "Error: %a@." Monopam.pp_error_with_hint e;
+3 -1
bin/cmd_verse.ml
··· 363 363 Common.with_verse_config env @@ fun config -> 364 364 let fs = Eio.Stdenv.fs env in 365 365 let proc = Eio.Stdenv.process_mgr env in 366 + Eio.Switch.run @@ fun sw -> 366 367 match 367 - Monopam.Verse.fork ~proc ~fs ~config ~handle ~package ~fork_url ~dry_run () 368 + Monopam.Verse.fork ~sw ~proc ~fs ~config ~handle ~package ~fork_url ~dry_run 369 + () 368 370 with 369 371 | Ok result -> 370 372 handle_fork_success ~fs ~config ~dry_run result;
+1 -1
lib/add.ml
··· 10 10 let run ~sw ~proc ~fs ~config ~package:pkg_name () = 11 11 let fs_t = Ctx.fs_typed fs in 12 12 Ctx.ensure_checkouts_dir ~fs:fs_t ~config; 13 - match Init.ensure ~proc ~fs:fs_t ~config with 13 + match Init.ensure ~sw ~proc ~fs:fs_t ~config with 14 14 | Error e -> Error e 15 15 | Ok () -> ( 16 16 match Ctx.package ~fs:(fs_t :> _ Eio.Path.t) ~config pkg_name with
+1 -1
test/test_clean.ml
··· 3 3 let test_module_alias () = 4 4 ignore 5 5 (Monopam.Clean.run 6 - : proc:_ -> fs:_ -> config:_ -> dry_run:_ -> force:_ -> unit -> _) 6 + : sw:_ -> proc:_ -> fs:_ -> config:_ -> dry_run:_ -> force:_ -> unit -> _) 7 7 8 8 let suite = 9 9 ("clean", [ Alcotest.test_case "module alias" `Quick test_module_alias ])
+16 -15
test/test_deps.ml
··· 54 54 Eio_main.run @@ fun env -> 55 55 let fs = Eio.Stdenv.fs env in 56 56 let proc = Eio.Stdenv.process_mgr env in 57 + Eio.Switch.run @@ fun sw -> 57 58 let tmp = Filename.temp_dir "test_deps_" "" in 58 59 Fun.protect ~finally:(fun () -> rm_rf tmp) @@ fun () -> 59 - fn ~fs ~proc ~target:(Fpath.v tmp) ~tmp 60 + fn ~sw ~fs ~proc ~target:(Fpath.v tmp) ~tmp 60 61 61 62 (* Test: missing sources.toml loads as empty *) 62 63 let test_load_missing () = 63 - with_tmp_env @@ fun ~fs ~proc:_ ~target ~tmp:_ -> 64 + with_tmp_env @@ fun ~sw:_ ~fs ~proc:_ ~target ~tmp:_ -> 64 65 let path = Fpath.(target / "sources.toml") in 65 66 let sources = SR.load ~fs path in 66 67 Alcotest.(check (result (list reject) string)) ··· 69 70 70 71 (* Test: empty sources.toml loads as empty *) 71 72 let test_load_empty () = 72 - with_tmp_env @@ fun ~fs ~proc:_ ~target ~tmp:_ -> 73 + with_tmp_env @@ fun ~sw:_ ~fs ~proc:_ ~target ~tmp:_ -> 73 74 write_sources ~fs ~target []; 74 75 let path = Fpath.(target / "sources.toml") in 75 76 let sources = SR.load ~fs path in ··· 79 80 80 81 (* Test: run with missing sources.toml succeeds (nothing to do) *) 81 82 let test_run_no_sources () = 82 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp:_ -> 83 - let result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:true () in 83 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp:_ -> 84 + let result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:true () in 84 85 Alcotest.(check result_testable) "no sources → Ok" (Ok ()) result 85 86 86 87 (* Test: run with entries whose dirs already exist skips them *) 87 88 let test_run_existing_dirs_skipped () = 88 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp -> 89 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp -> 89 90 write_sources ~fs ~target 90 91 [ 91 92 ("foo", entry "git+https://example.com/foo"); ··· 93 94 ]; 94 95 Sys.mkdir (Filename.concat tmp "foo") 0o755; 95 96 Sys.mkdir (Filename.concat tmp "bar") 0o755; 96 - let result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:true () in 97 + let result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:true () in 97 98 Alcotest.(check result_testable) "existing dirs → Ok" (Ok ()) result 98 99 99 100 (* Test: dry run with missing dirs succeeds (Import.git_url returns Ok in 100 101 dry_run mode without actually fetching) *) 101 102 let test_run_dry_run_succeeds () = 102 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp:_ -> 103 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp:_ -> 103 104 write_sources ~fs ~target 104 105 [ 105 106 ("pkg-a", entry "git+https://example.com/pkg-a"); 106 107 ("pkg-b", entry "git+https://example.com/pkg-b"); 107 108 ]; 108 - let result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:true () in 109 + let result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:true () in 109 110 Alcotest.(check result_testable) "dry_run succeeds" (Ok ()) result 110 111 111 112 (* Test: dry run does not create subdirectories *) 112 113 let test_dry_run_no_effects () = 113 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp -> 114 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp -> 114 115 write_sources ~fs ~target 115 116 [ ("should-not-exist", entry "git+https://example.com/repo") ]; 116 - let _result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:true () in 117 + let _result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:true () in 117 118 Alcotest.(check bool) 118 119 "dir not created by dry_run" false 119 120 (Sys.file_exists (Filename.concat tmp "should-not-exist")) 120 121 121 122 (* Test: non-dry-run import of bogus URL returns error mentioning package *) 122 123 let test_run_import_error () = 123 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp:_ -> 124 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp:_ -> 124 125 (* Init a git repo so git fetch can at least be attempted *) 125 126 Eio.Process.run proc [ "git"; "-C"; Fpath.to_string target; "init" ]; 126 127 Eio.Process.run proc ··· 135 136 ]; 136 137 write_sources ~fs ~target 137 138 [ ("bogus-pkg", entry "git+https://invalid.example.com/no-repo") ]; 138 - let result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:false () in 139 + let result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:false () in 139 140 match result with 140 141 | Error msg -> 141 142 Alcotest.(check bool) ··· 145 146 146 147 (* Test: mixed existing/missing dirs — existing skipped, missing fails *) 147 148 let test_run_partial_skip () = 148 - with_tmp_env @@ fun ~fs ~proc ~target ~tmp -> 149 + with_tmp_env @@ fun ~sw ~fs ~proc ~target ~tmp -> 149 150 Eio.Process.run proc [ "git"; "-C"; Fpath.to_string target; "init" ]; 150 151 Eio.Process.run proc 151 152 [ ··· 163 164 ("missing-pkg", entry "git+https://invalid.example.com/missing"); 164 165 ]; 165 166 Sys.mkdir (Filename.concat tmp "existing-pkg") 0o755; 166 - let result = Monopam.Deps.run ~proc ~fs ~target ~dry_run:false () in 167 + let result = Monopam.Deps.run ~sw ~proc ~fs ~target ~dry_run:false () in 167 168 match result with 168 169 | Error msg -> 169 170 Alcotest.(check bool)
+1 -1
test/test_init.ml
··· 1 1 (* Tests for init module - I/O heavy, verify module alias works *) 2 2 3 3 let test_module_alias () = 4 - ignore (Monopam.Init.ensure : proc:_ -> fs:_ -> config:_ -> _) 4 + ignore (Monopam.Init.ensure : sw:_ -> proc:_ -> fs:_ -> config:_ -> _) 5 5 6 6 let suite = 7 7 ("init", [ Alcotest.test_case "module alias" `Quick test_module_alias ])
+2 -1
test/test_pull.ml
··· 3 3 let test_module_alias () = 4 4 ignore 5 5 (Monopam.Pull.run 6 - : proc:_ -> 6 + : sw:_ -> 7 + proc:_ -> 7 8 fs:_ -> 8 9 config:_ -> 9 10 ?packages:_ ->
+2 -1
test/test_push.ml
··· 3 3 let test_module_alias () = 4 4 ignore 5 5 (Monopam.Push.run 6 - : proc:_ -> 6 + : sw:_ -> 7 + proc:_ -> 7 8 fs:_ -> 8 9 config:_ -> 9 10 ?packages:_ ->