diff --git a/master_changes.md b/master_changes.md index f8ed5aa796d..e6c8144cdf0 100644 --- a/master_changes.md +++ b/master_changes.md @@ -22,6 +22,7 @@ users) ## Init ## Config report + * add the list of all installed repositories to a new all-repositories field [#5799 @kit-ty-kate] ## Actions diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml index dc72f544ff3..b9a4c9d81e1 100644 --- a/src/client/opamCommands.ml +++ b/src/client/opamCommands.ml @@ -1487,12 +1487,9 @@ let config cli = if n <> 0 then [Printf.sprintf "%d (%s)" n label] else [] in print "jobs" "%d" (Lazy.force OpamStateConfig.(!r.jobs)); - match OpamStateConfig.get_switch_opt () with - | None -> print "current-switch" "%s" "none set"; `Ok () - | Some switch -> - OpamSwitchState.with_ `Lock_none ~switch gt @@ fun state -> - print "repositories" "%s" - (let repos = state.switch_repos.repositories in + let print_repositories name rt = + print name "%s" + (let repos = rt.repositories in let default, nhttp, nlocal, nvcs = OpamRepositoryName.Map.fold (fun _ repo (dft, nhttp, nlocal, nvcs) -> @@ -1502,7 +1499,7 @@ let config cli = then OpamRepositoryName.Map.find repo.repo_name - state.switch_repos.repos_definitions |> + rt.repos_definitions |> OpamFile.Repo.stamp else dft in @@ -1520,6 +1517,14 @@ let config cli = | Some v -> Printf.sprintf " (default repo at %s)" v | None -> "" ); + in + OpamRepositoryState.with_ `Lock_none gt @@ fun rt -> + print_repositories "all-repositories" rt; + match OpamStateConfig.get_switch_opt () with + | None -> print "current-switch" "%s" "none set"; `Ok () + | Some switch -> + OpamSwitchState.with_ `Lock_none ~switch gt @@ fun state -> + print_repositories "repositories" state.switch_repos; print "pinned" "%s" (if OpamPackage.Set.is_empty state.pinned then "0" else let pinnings = diff --git a/tests/reftests/config.test b/tests/reftests/config.test index 551a4be305c..4148b5e1308 100644 --- a/tests/reftests/config.test +++ b/tests/reftests/config.test @@ -38,6 +38,7 @@ Set to '"-removed"' the field solver-upgrade-criteria in global configuration # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 1 (local) # current-switch none set ### # empty switch ### opam switch create an-empty-switch --empty @@ -50,6 +51,7 @@ Set to '"-removed"' the field solver-upgrade-criteria in global configuration # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 1 (local) # repositories 1 (local) # pinned 0 # current-switch an-empty-switch @@ -120,6 +122,7 @@ Done. # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 2 (local) # repositories 2 (local) # pinned 1 (rsync) # current-switch a-switch @@ -152,6 +155,7 @@ Done. # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 1 (local) # repositories 1 (local) # pinned 0 # current-switch an-empty-invariant-with-compiler @@ -180,6 +184,7 @@ Done. # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 1 (local) # repositories 1 (local) # pinned 0 # current-switch a-package-invariant @@ -208,6 +213,7 @@ Done. # install-criteria -removed # upgrade-criteria -removed # jobs 1 +# all-repositories 1 (local) # repositories 1 (local) # pinned 0 # current-switch a-compiler-with-depopt