LCOV - code coverage report
Current view: top level - src/esys/repo/manifest - revisionset_manifest.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 20 29 69.0 %
Date: 2026-08-12 14:26:50 Functions: 8 12 66.7 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/manifest/revisionset_manifest.cpp
       3             :  * \brief Named revision-set implementation (ADR-0020)
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2026 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #include "esys/repo/esysrepo_prec.h"
      19             : #include "esys/repo/manifest/revisionset.h"
      20             : 
      21             : namespace esys::repo::manifest
      22             : {
      23             : 
      24           0 : RevisionSet::RevisionSet() = default;
      25             : 
      26           5 : RevisionSet::RevisionSet(const std::string &name)
      27           5 :     : m_name(name)
      28             : {
      29           5 : }
      30             : 
      31           5 : RevisionSet::~RevisionSet() = default;
      32             : 
      33           0 : void RevisionSet::set_name(const std::string &name)
      34             : {
      35           0 :     m_name = name;
      36           0 : }
      37             : 
      38           7 : const std::string &RevisionSet::get_name() const
      39             : {
      40           7 :     return m_name;
      41             : }
      42             : 
      43           5 : void RevisionSet::set_default_revision(const std::string &revision)
      44             : {
      45           5 :     m_default_revision = revision;
      46           5 : }
      47             : 
      48          14 : const std::string &RevisionSet::get_default_revision() const
      49             : {
      50          14 :     return m_default_revision;
      51             : }
      52             : 
      53           2 : void RevisionSet::set_repo_revision(const std::string &path, const std::string &revision)
      54             : {
      55           2 :     m_repo_revisions[path] = revision;
      56           2 : }
      57             : 
      58           8 : std::string RevisionSet::get_repo_revision(const std::string &path) const
      59             : {
      60           8 :     auto it = m_repo_revisions.find(path);
      61           8 :     if (it == m_repo_revisions.end()) return {};
      62           3 :     return it->second;
      63             : }
      64             : 
      65           2 : const std::map<std::string, std::string> &RevisionSet::get_repo_revisions() const
      66             : {
      67           2 :     return m_repo_revisions;
      68             : }
      69             : 
      70           0 : void RevisionSet::clear()
      71             : {
      72           0 :     m_name.clear();
      73           0 :     m_default_revision.clear();
      74           0 :     m_repo_revisions.clear();
      75           0 : }
      76             : 
      77             : } // namespace esys::repo::manifest

Generated by: LCOV version 1.14