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-12 14:26:50 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       19565 : Progress::Progress() = default;
      27             : 
      28       36035 : void Progress::set_fetch_step(FetchStep fetch_step)
      29             : {
      30       36035 :     m_fetch_step = fetch_step;
      31       36035 : }
      32             : 
      33       25110 : FetchStep Progress::get_fetch_step() const
      34             : {
      35       25110 :     return m_fetch_step;
      36             : }
      37             : 
      38       35208 : FetchStep &Progress::get_fetch_step()
      39             : {
      40       35208 :     return m_fetch_step;
      41             : }
      42             : 
      43       54013 : void Progress::set_percentage(int percentage)
      44             : {
      45       54013 :     m_percentage = percentage;
      46       54013 : }
      47             : 
      48        1436 : int Progress::get_percentage() const
      49             : {
      50        1436 :     return m_percentage;
      51             : }
      52             : 
      53         243 : int &Progress::get_percentage()
      54             : {
      55         243 :     return m_percentage;
      56             : }
      57             : 
      58         547 : void Progress::set_started(bool started)
      59             : {
      60         547 :     m_started = started;
      61         547 : }
      62             : 
      63       21612 : bool Progress::get_started() const
      64             : {
      65       21612 :     return m_started;
      66             : }
      67             : 
      68         192 : bool &Progress::get_started()
      69             : {
      70         192 :     return m_started;
      71             : }
      72             : 
      73       19364 : void Progress::set_done(bool done)
      74             : {
      75       19364 :     m_done = done;
      76       19364 : }
      77             : 
      78       20867 : bool Progress::get_done() const
      79             : {
      80       20867 :     return m_done;
      81             : }
      82             : 
      83         243 : bool &Progress::get_done()
      84             : {
      85         243 :     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       13959 : void Progress::set_total_objects(int total_objects)
     117             : {
     118       13959 :     m_total_objects = total_objects;
     119       13959 : }
     120             : 
     121        1442 : int Progress::get_total_objects() const
     122             : {
     123        1442 :     return m_total_objects;
     124             : }
     125             : 
     126       13959 : void Progress::set_received_objects(int received_objects)
     127             : {
     128       13959 :     m_received_objects = received_objects;
     129       13959 : }
     130             : 
     131        1442 : int Progress::get_received_objects() const
     132             : {
     133        1442 :     return m_received_objects;
     134             : }
     135             : 
     136        6310 : void Progress::set_indexed_objects(int indexed_objects)
     137             : {
     138        6310 :     m_indexed_objects = indexed_objects;
     139        6310 : }
     140             : 
     141        1437 : int Progress::get_indexed_objects() const
     142             : {
     143        1437 :     return m_indexed_objects;
     144             : }
     145             : 
     146        4558 : void Progress::set_total_deltas(int total_deltas)
     147             : {
     148        4558 :     m_total_deltas = total_deltas;
     149        4558 : }
     150             : 
     151        1442 : int Progress::get_total_deltas() const
     152             : {
     153        1442 :     return m_total_deltas;
     154             : }
     155             : 
     156        4558 : void Progress::set_indexed_deltas(int indexed_deltas)
     157             : {
     158        4558 :     m_indexed_deltas = indexed_deltas;
     159        4558 : }
     160             : 
     161        1442 : int Progress::get_indexed_deltas() const
     162             : {
     163        1442 :     return m_indexed_deltas;
     164             : }
     165             : 
     166         538 : void Progress::set_received_bytes(std::int64_t received_bytes)
     167             : {
     168         538 :     m_received_bytes = received_bytes;
     169         538 : }
     170             : 
     171        1437 : std::int64_t Progress::get_received_bytes() const
     172             : {
     173        1437 :     return m_received_bytes;
     174             : }
     175             : 
     176             : } // namespace esys::repo::git

Generated by: LCOV version 1.14