From 5fbba3abfa6e725b47a170b0c4f7ce5f8c2671e7 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 20 Sep 2023 10:49:03 +0200 Subject: just-mr: add option to override the absent pragma Using absent repositories depends on a just-serve endpoint. As such, it is not a datum of the project, but one of the available infrastructure. As the latter can change independently of the project, it is desriable to have the option to specify those pieces of information in separate files. --- src/other_tools/just_mr/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/other_tools/just_mr/main.cpp') diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 85105e50..1e8905d6 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -590,6 +590,21 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { } } } + // read path to absent repository specification if not already provided by + // the user + if (not clargs->common.absent_repository_file) { + auto absent_order = rc_config["absent"]; + if (absent_order.IsNotNull() and absent_order->IsList()) { + for (auto const& entry : absent_order->List()) { + auto path = ReadLocation( + entry, clargs->common.just_mr_paths->workspace_root); + if (path and FileSystemManager::IsFile(path->first)) { + clargs->common.absent_repository_file = path->first; + break; + } + } + } + } // read config lookup order auto config_lookup_order = rc_config["config lookup order"]; if (config_lookup_order.IsNotNull()) { @@ -744,7 +759,8 @@ auto main(int argc, char* argv[]) -> int { } // The remaining options all need the config file - auto config = JustMR::Utils::ReadConfiguration(config_file); + auto config = JustMR::Utils::ReadConfiguration( + config_file, arguments.common.absent_repository_file); // Run subcommand `setup` or `setup-env` if (arguments.cmd == SubCommand::kSetup or -- cgit v1.2.3