LCOV - code coverage report
Current view: top level - src/esys/repo/git - progress_git.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 59 79 74.7 %
Date: 2026-08-01 10:43:40 Functions: 25 27 92.6 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/git/progress_git.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2020-2023 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/git/progress.h"
      20             : 
      21             : #include <iomanip>
      22             : 
      23             : namespace esys::repo::git
      24             : {
      25             : 
      26      109499 : Progress::Progress() = default;
      27             : 
      28      114793 : void Progress::set_fetch_step(FetchStep fetch_step)
      29             : {
      30      114793 :     m_fetch_step = fetch_step;
      31      114793 : }
      32             : 
      33      114246 : FetchStep Progress::get_fetch_step() const
      34             : {
      35      114246 :     return m_fetch_step;
      36             : }
      37             : 
      38        8476 : FetchStep &Progress::get_fetch_step()
      39             : {
      40        8476 :     return m_fetch_step;
      41             : }
      42             : 
      43      122974 : void Progress::set_percentage(int percentage)
      44             : {
      45      122974 :     m_percentage = percentage;
      46      122974 : }
      47             : 
      48        1154 : int Progress::get_percentage() const
      49             : {
      50        1154 :     return m_percentage;
      51             : }
      52             : 
      53         108 : int &Progress::get_percentage()
      54             : {
      55         108 :     return m_percentage;
      56             : }
      57             : 
      58         598 : void Progress::set_started(bool started)
      59             : {
      60         598 :     m_started = started;
      61         598 : }
      62             : 
      63      111426 : bool Progress::get_started() const
      64             : {
      65      111426 :     return m_started;
      66             : }
      67             : 
      68          45 : bool &Progress::get_started()
      69             : {
      70          45 :     return m_started;
      71             : }
      72             : 
      73      114681 : void Progress::set_done(bool done)
      74             : {
      75      114681 :     m_done = done;
      76      114681 : }
      77             : 
      78      110555 : bool Progress::get_done() const
      79             : {
      80      110555 :     return m_done;
      81             : }
      82             : 
      83         101 : bool &Progress::get_done()
      84             : {
      85         101 :     return m_done;
      86             : }
      87             : 
      88           0 : void Progress::print(std::ostream &os)
      89             : {
      90           0 :     os << "[";
      91           0 : }
      92             : 
      93           0 : void Progress::print(std::ostream &os, std::size_t id)
      94             : {
      95           0 :     os << "[" << std::setw(2) << id << ": ";
      96             : 
      97           0 :     switch (get_fetch_step())
      98             :     {
      99           0 :         case FetchStep::NOT_SET: os << "0"; break;
     100           0 :         case FetchStep::ENUMERATING: os << "1"; break;
     101           0 :         case FetchStep::COUNTING: os << "2"; break;
     102           0 :         case FetchStep::COMPRESSING: os << "3"; break;
     103           0 :         case FetchStep::TOTAL: os << "4"; break;
     104           0 :         case FetchStep::RECEIVING: os << "5"; break;
     105           0 :         case FetchStep::RESOLVING: os << "6"; break;
     106           0 :         default: os << "?"; break;
     107             :     }
     108           0 :     os << "/6 ";
     109           0 :     if ((m_done) || (get_percentage() == MAX_PERCENTAGE) || (get_percentage() < 0))
     110           0 :         os << "  ";
     111             :     else
     112           0 :         os << std::setw(2) << get_percentage();
     113           0 :     os << "]";
     114           0 : }
     115             : 
     116      111290 : void Progress::set_total_objects(int total_objects)
     117             : {
     118      111290 :     m_total_objects = total_objects;
     119      111290 : }
     120             : 
     121        1160 : int Progress::get_total_objects() const
     122             : {
     123        1160 :     return m_total_objects;
     124             : }
     125             : 
     126      111290 : void Progress::set_received_objects(int received_objects)
     127             : {
     128      111290 :     m_received_objects = received_objects;
     129      111290 : }
     130             : 
     131        1160 : int Progress::get_received_objects() const
     132             : {
     133        1160 :     return m_received_objects;
     134             : }
     135             : 
     136      106266 : void Progress::set_indexed_objects(int indexed_objects)
     137             : {
     138      106266 :     m_indexed_objects = indexed_objects;
     139      106266 : }
     140             : 
     141        1155 : int Progress::get_indexed_objects() const
     142             : {
     143        1155 :     return m_indexed_objects;
     144             : }
     145             : 
     146      106266 : void Progress::set_total_deltas(int total_deltas)
     147             : {
     148      106266 :     m_total_deltas = total_deltas;
     149      106266 : }
     150             : 
     151        1160 : int Progress::get_total_deltas() const
     152             : {
     153        1160 :     return m_total_deltas;
     154             : }
     155             : 
     156      106266 : void Progress::set_indexed_deltas(int indexed_deltas)
     157             : {
     158      106266 :     m_indexed_deltas = indexed_deltas;
     159      106266 : }
     160             : 
     161        1160 : int Progress::get_indexed_deltas() const
     162             : {
     163        1160 :     return m_indexed_deltas;
     164             : }
     165             : 
     166      106261 : void Progress::set_received_bytes(std::int64_t received_bytes)
     167             : {
     168      106261 :     m_received_bytes = received_bytes;
     169      106261 : }
     170             : 
     171        1155 : std::int64_t Progress::get_received_bytes() const
     172             : {
     173        1155 :     return m_received_bytes;
     174             : }
     175             : 
     176             : } // namespace esys::repo::git

Generated by: LCOV version 1.14