From 6fa286a674059f2f4a4dd6033aacb13b2d6d1e40 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 14 Jan 2025 11:50:51 +0100 Subject: TreeStructureUtils: import to git Unify logic from evaluator of precomputed roots. --- .../tree_structure/tree_structure_utils.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/buildtool/tree_structure/tree_structure_utils.hpp') diff --git a/src/buildtool/tree_structure/tree_structure_utils.hpp b/src/buildtool/tree_structure/tree_structure_utils.hpp index 56dd1249..df2f9f5e 100644 --- a/src/buildtool/tree_structure/tree_structure_utils.hpp +++ b/src/buildtool/tree_structure/tree_structure_utils.hpp @@ -15,9 +15,13 @@ #ifndef INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP #define INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP +#include #include +#include "gsl/gsl" #include "src/buildtool/common/artifact_digest.hpp" +#include "src/buildtool/execution_api/common/execution_api.hpp" +#include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/buildtool/tree_structure/tree_structure_cache.hpp" #include "src/utils/cpp/expected.hpp" @@ -39,6 +43,22 @@ class TreeStructureUtils final { Storage const& storage, TreeStructureCache const& cache) noexcept -> expected; + + /// \brief Import a git tree from the given source to storage_config's git + /// repo. + /// \param tree GitSHA1 tree to import + /// \param source_api The source of the tree. Must be capable of + /// processing GitSHA1 trees. + /// \param target_config Config with target git repo. + /// \param tagging_lock Mutex to protect critical tagging operation + /// \return Digest of the tree that is available in the repo after the + /// call or an error message on failure. + [[nodiscard]] static auto ImportToGit( + ArtifactDigest const& tree, + IExecutionApi const& source_api, + StorageConfig const& target_config, + gsl::not_null const& tagging_lock) noexcept + -> expected; }; #endif // INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP -- cgit v1.2.3