summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/just_mr')
-rw-r--r--src/other_tools/just_mr/fetch.cpp5
-rw-r--r--src/other_tools/just_mr/launch.cpp20
-rw-r--r--src/other_tools/just_mr/mirrors.hpp2
-rw-r--r--src/other_tools/just_mr/update.cpp6
4 files changed, 18 insertions, 15 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp
index 3585d2f3..a7afc575 100644
--- a/src/other_tools/just_mr/fetch.cpp
+++ b/src/other_tools/just_mr/fetch.cpp
@@ -223,7 +223,8 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
return kExitFetchError;
}
auto repo_type_str = repo_type->get()->String();
- if (not kCheckoutTypeMap.contains(repo_type_str)) {
+ auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str);
+ if (checkout_type_it == kCheckoutTypeMap.end()) {
Logger::Log(LogLevel::Error,
"Config: Unknown repository type {} for {}",
nlohmann::json(repo_type_str).dump(),
@@ -231,7 +232,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
return kExitFetchError;
}
// only do work if repo is archive or git tree type
- switch (kCheckoutTypeMap.at(repo_type_str)) {
+ switch (checkout_type_it->second) {
case CheckoutType::Archive: {
auto logger = std::make_shared<AsyncMapConsumerLogger>(
[&repo_name](std::string const& msg, bool fatal) {
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp
index 0a061031..c085f5be 100644
--- a/src/other_tools/just_mr/launch.cpp
+++ b/src/other_tools/just_mr/launch.cpp
@@ -93,8 +93,9 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
std::optional<LockFile> lock{};
if (subcommand and kKnownJustSubcommands.contains(*subcommand)) {
+ auto const& flags = kKnownJustSubcommands.at(*subcommand);
// Read the config file if needed
- if (kKnownJustSubcommands.at(*subcommand).config) {
+ if (flags.config) {
auto repo_lock =
RepositoryGarbageCollector::SharedLock(storage_config);
if (not repo_lock) {
@@ -128,15 +129,14 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
return kExitSetupError;
}
}
- use_build_root = kKnownJustSubcommands.at(*subcommand).build_root;
- use_launcher = kKnownJustSubcommands.at(*subcommand).launch;
- supports_defines = kKnownJustSubcommands.at(*subcommand).defines;
- supports_remote = kKnownJustSubcommands.at(*subcommand).remote;
- supports_remote_properties =
- kKnownJustSubcommands.at(*subcommand).remote_props;
- supports_serve = kKnownJustSubcommands.at(*subcommand).serve;
- supports_dispatch = kKnownJustSubcommands.at(*subcommand).dispatch;
- does_build = kKnownJustSubcommands.at(*subcommand).does_build;
+ use_build_root = flags.build_root;
+ use_launcher = flags.launch;
+ supports_defines = flags.defines;
+ supports_remote = flags.remote;
+ supports_remote_properties = flags.remote_props;
+ supports_serve = flags.serve;
+ supports_dispatch = flags.dispatch;
+ does_build = flags.does_build;
}
// build just command
std::vector<std::string> cmd = {common_args.just_path->string()};
diff --git a/src/other_tools/just_mr/mirrors.hpp b/src/other_tools/just_mr/mirrors.hpp
index 7480a839..41351bbb 100644
--- a/src/other_tools/just_mr/mirrors.hpp
+++ b/src/other_tools/just_mr/mirrors.hpp
@@ -158,7 +158,7 @@ namespace MirrorsUtils {
CurlURLHandle::GetHostname(mirror).value_or(std::string{});
auto it = mirrors_by_hostname.find(hostname);
if (it != mirrors_by_hostname.end()) {
- mirrors_by_hostname.at(hostname).emplace_back(mirror);
+ it->second.emplace_back(mirror);
}
else {
// add missing or unknown hostnames to fallback list with key ""
diff --git a/src/other_tools/just_mr/update.cpp b/src/other_tools/just_mr/update.cpp
index e2ed9197..43fd2de6 100644
--- a/src/other_tools/just_mr/update.cpp
+++ b/src/other_tools/just_mr/update.cpp
@@ -24,6 +24,7 @@
#include <optional>
#include <thread>
#include <unordered_map>
+#include <utility>
#include <vector>
#include "fmt/core.h"
@@ -118,7 +119,8 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config,
return kExitUpdateError;
}
auto repo_type_str = repo_type->get()->String();
- if (not kCheckoutTypeMap.contains(repo_type_str)) {
+ auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str);
+ if (checkout_type_it == kCheckoutTypeMap.end()) {
Logger::Log(LogLevel::Error,
"Unknown repository type {} for {}",
nlohmann::json(repo_type_str).dump(),
@@ -126,7 +128,7 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config,
return kExitUpdateError;
}
// only do work if repo is git type
- if (kCheckoutTypeMap.at(repo_type_str) == CheckoutType::Git) {
+ if (checkout_type_it->second == CheckoutType::Git) {
auto repo_desc_repository =
(*resolved_repo_desc)->At("repository");
if (not repo_desc_repository) {