diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-22 16:05:53 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-23 10:24:39 +0200 |
commit | 4a9c4f50cc0ad0bcd4b26a027c4e80d5d43c9f9d (patch) | |
tree | e24499f845a7b4ab4f29eee33a35a976b160b791 /src/other_tools/ops_maps/git_update_map.cpp | |
parent | 0aab4ee769211fa90e51926ae4411da29c1c0776 (diff) | |
download | justbuild-4a9c4f50cc0ad0bcd4b26a027c4e80d5d43c9f9d.tar.gz |
just-mr: Use statistics and progress instances update map
...instead of using the singletons.
Diffstat (limited to 'src/other_tools/ops_maps/git_update_map.cpp')
-rw-r--r-- | src/other_tools/ops_maps/git_update_map.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/other_tools/ops_maps/git_update_map.cpp b/src/other_tools/ops_maps/git_update_map.cpp index de3bfb25..510b9d1c 100644 --- a/src/other_tools/ops_maps/git_update_map.cpp +++ b/src/other_tools/ops_maps/git_update_map.cpp @@ -17,21 +17,25 @@ #include "fmt/core.h" #include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/storage/fs_utils.hpp" -#include "src/other_tools/just_mr/progress_reporting/progress.hpp" -#include "src/other_tools/just_mr/progress_reporting/statistics.hpp" auto CreateGitUpdateMap( GitCASPtr const& git_cas, std::string const& git_bin, std::vector<std::string> const& launcher, gsl::not_null<StorageConfig const*> const& storage_config, + gsl::not_null<JustMRStatistics*> const& stats, + gsl::not_null<JustMRProgress*> const& progress, std::size_t jobs) -> GitUpdateMap { - auto update_commits = [git_cas, git_bin, launcher, storage_config]( - auto /* unused */, - auto setter, - auto logger, - auto /* unused */, - auto const& key) { + auto update_commits = [git_cas, + git_bin, + launcher, + storage_config, + stats, + progress](auto /* unused */, + auto setter, + auto logger, + auto /* unused */, + auto const& key) { // perform git update commit auto git_repo = GitRepoRemote::Open(git_cas); // wrap the tmp odb if (not git_repo) { @@ -50,7 +54,7 @@ auto CreateGitUpdateMap( }); // update commit auto id = fmt::format("{}:{}", key.repo, key.branch); - JustMRProgress::Instance().TaskTracker().Start(id); + progress->TaskTracker().Start(id); auto new_commit = git_repo->UpdateCommitViaTmpRepo(*storage_config, key.repo, key.branch, @@ -58,11 +62,11 @@ auto CreateGitUpdateMap( git_bin, launcher, wrapped_logger); - JustMRProgress::Instance().TaskTracker().Stop(id); + progress->TaskTracker().Stop(id); if (not new_commit) { return; } - JustMRStatistics::Instance().IncrementExecutedCounter(); + stats->IncrementExecutedCounter(); (*setter)(new_commit->c_str()); }; return AsyncMapConsumer<RepoDescriptionForUpdating, std::string>( |