source: branches/0.7-stable/lib/ClassicStats.cc @ 1033

Last change on this file since 1033 was 1033, checked in by Peter Johansson, 11 years ago

updating copyrights

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1// $Id: ClassicStats.cc 1033 2010-02-15 04:57:24Z peter $
2
3/*
4  Copyright (C) 2005 Peter Johansson
5  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
6  Copyright (C) 2009, 2010 Peter Johansson
7
8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
9
10  svndigest is free software; you can redistribute it and/or modify it
11  under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 3 of the License, or
13  (at your option) any later version.
14
15  svndigest is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
22*/
23
24#include "ClassicStats.h"
25
26#include "Functor.h"
27#include "SVNblame.h"
28#include "SVNinfo.h"
29#include "utility.h"
30
31#include <algorithm>
32#include <cassert>
33#include <cstdlib>
34#include <fstream>
35#include <iostream>
36#include <iterator>
37#include <map>
38#include <numeric>
39#include <string>
40#include <sstream>
41#include <unistd.h>
42#include <utility>
43#include <vector>
44
45
46namespace theplu{
47namespace svndigest{
48
49
50  ClassicStats::ClassicStats(const std::string& path)
51    : Stats(path)
52  {
53  }
54
55
56  ClassicStats::ClassicStats(const ClassicStats& other)
57  : Stats(other)
58  {
59  }
60
61
62  void ClassicStats::do_parse(const std::string& path, svn_revnum_t rev)
63  {
64    reset();
65    LineTypeParser parser(path);
66    SVNblame svn_blame(path);
67    while (svn_blame.valid()) {
68      add(svn_blame.author(), svn_blame.revision(), 
69          parser.parse(svn_blame.line()));
70      svn_blame.next_line();
71    }
72    accumulate_stats();
73  }
74
75
76  unsigned int 
77  ClassicStats::max_element(const std::vector<unsigned int>& v) const 
78  {
79    assert(v.size());
80    return v.back();
81  }
82
83}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.