Changeset 543 for trunk/lib/AddStats.cc


Ignore:
Timestamp:
Jan 4, 2008, 3:10:54 AM (14 years ago)
Author:
Peter Johansson
Message:

AddStats - number of added lines is counted - fixes ticket:82

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/lib/AddStats.cc

    r541 r543  
    22
    33/*
    4   Copyright (C) 2005 Peter Johansson
    5   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2008 Peter Johansson
    65
    76  This file is part of svndigest, http://trac.thep.lu.se/svndigest
     
    2322*/
    2423
    25 #include "BlameStats.h"
     24#include "AddStats.h"
    2625
    27 #include "Functor.h"
    28 #include "GnuplotFE.h"
    2926#include "SVNblame.h"
    30 #include "SVNinfo.h"
    3127#include "SVNlog.h"
    3228#include "utility.h"
     
    3531#include <cassert>
    3632#include <cstdlib>
    37 #include <fstream>
    38 #include <iostream>
    39 #include <iterator>
    4033#include <map>
    41 #include <numeric>
    4234#include <string>
    43 #include <sstream>
    44 #include <unistd.h>
    45 #include <utility>
    4635#include <vector>
    4736
     37//debug
     38#include <iostream>
    4839
    4940namespace theplu{
     
    5142
    5243
    53   BlameStats::BlameStats(const std::string& path)
     44  AddStats::AddStats(const std::string& path)
    5445    : Stats(path)
    5546  {
     
    5748
    5849
    59   BlameStats::BlameStats(const BlameStats& other)
     50  AddStats::AddStats(const AddStats& other)
    6051  : Stats(other)
    6152  {
     
    6354
    6455
    65   void BlameStats::fill_in(Author2Vector& a2v, svn_revnum_t rev)
    66   {
    67     assert(rev);
    68     for (std::set<std::string>::const_iterator iter(authors().begin());
    69          iter!=authors().end(); ++iter) {
    70       std::vector<u_int>& vec = a2v[*iter];
    71       vec.resize(revision()+1);
    72       assert(rev<static_cast<svn_revnum_t>(vec.size()));
    73       vec[rev]=vec[rev-1];
    74     }
    75   }
    76 
    77 
    78   void BlameStats::do_parse(const std::string& path)
     56  void AddStats::do_parse(const std::string& path)
    7957  {
    8058    Parser parser(path);
     
    8765      SVNblame svn_blame(path, *rev_iter);
    8866      while (svn_blame.valid()) {
    89         add(svn_blame.author(), *rev_iter, parser.parse(svn_blame.line()));
     67        std::cout << path << " " << *rev_iter << " " << svn_blame.revision() << " " << svn_blame.author() << "\n";
     68        if (*rev_iter==svn_blame.revision())
     69          add(svn_blame.author(), *rev_iter, parser.parse(svn_blame.line()));
    9070        // I dont trust blame and log behave consistent (stop-on-copy).
    9171        revs.insert(svn_blame.revision());
     
    9474    }
    9575   
    96     // filling in pristine revisions
    97     RevSet::iterator rev_iter=revs.begin();
    98     for (svn_revnum_t rev = 1; rev<=revision(); ++rev){
    99       if (rev==*rev_iter)
    100         ++rev_iter;
    101       else {
    102         fill_in(code_,rev);
    103         fill_in(comments_,rev);
    104         fill_in(other_,rev);
    105       }
    106     }
     76    accumulate_stats();
    10777  }
    10878
Note: See TracChangeset for help on using the changeset viewer.