Changeset 543
- Timestamp:
- Jan 4, 2008, 3:10:54 AM (15 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/AddStats.cc
r541 r543 2 2 3 3 /* 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 4 Copyright (C) 2008 Peter Johansson 6 5 7 6 This file is part of svndigest, http://trac.thep.lu.se/svndigest … … 23 22 */ 24 23 25 #include " BlameStats.h"24 #include "AddStats.h" 26 25 27 #include "Functor.h"28 #include "GnuplotFE.h"29 26 #include "SVNblame.h" 30 #include "SVNinfo.h"31 27 #include "SVNlog.h" 32 28 #include "utility.h" … … 35 31 #include <cassert> 36 32 #include <cstdlib> 37 #include <fstream>38 #include <iostream>39 #include <iterator>40 33 #include <map> 41 #include <numeric>42 34 #include <string> 43 #include <sstream>44 #include <unistd.h>45 #include <utility>46 35 #include <vector> 47 36 37 //debug 38 #include <iostream> 48 39 49 40 namespace theplu{ … … 51 42 52 43 53 BlameStats::BlameStats(const std::string& path)44 AddStats::AddStats(const std::string& path) 54 45 : Stats(path) 55 46 { … … 57 48 58 49 59 BlameStats::BlameStats(const BlameStats& other)50 AddStats::AddStats(const AddStats& other) 60 51 : Stats(other) 61 52 { … … 63 54 64 55 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) 79 57 { 80 58 Parser parser(path); … … 87 65 SVNblame svn_blame(path, *rev_iter); 88 66 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())); 90 70 // I dont trust blame and log behave consistent (stop-on-copy). 91 71 revs.insert(svn_blame.revision()); … … 94 74 } 95 75 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(); 107 77 } 108 78 -
trunk/lib/AddStats.h
r541 r543 1 #ifndef _theplu_svndigest_ blame_stats_2 #define _theplu_svndigest_ blame_stats_1 #ifndef _theplu_svndigest_add_stats_ 2 #define _theplu_svndigest_add_stats_ 3 3 4 4 // $Id$ 5 5 6 6 /* 7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2007 Peter Johansson 7 Copyright (C) 2008 Peter Johansson 10 8 11 9 This file is part of svndigest, http://trac.thep.lu.se/svndigest … … 35 33 /// Class taking care of statistics from svn. 36 34 /// 37 class BlameStats : public Stats35 class AddStats : public Stats 38 36 { 39 37 public: … … 41 39 /// @brief Default Constructor 42 40 /// 43 explicit BlameStats(const std::string& path);41 explicit AddStats(const std::string& path); 44 42 45 BlameStats(const BlameStats& other);43 AddStats(const AddStats& other); 46 44 47 45 private: 48 46 void do_parse(const std::string&); 49 void fill_in(Author2Vector&, svn_revnum_t rev);50 47 51 48 }; -
trunk/lib/Makefile.am
r540 r543 26 26 noinst_LTLIBRARIES = libsvndigest.la 27 27 28 noinst_HEADERS = A lias.h BlameStats.h ClassicStats.h ColumnStream.h \28 noinst_HEADERS = AddStats.h Alias.h BlameStats.h ClassicStats.h ColumnStream.h \ 29 29 Commitment.h Configuration.h css.h\ 30 30 Date.h Directory.h File.h first_page.h Functor.h Gnuplot.h GnuplotFE.h \ … … 33 33 SVNinfo.h SVNlog.h SVNproperty.h Trac.h utility.h 34 34 35 libsvndigest_la_SOURCES = A lias.cc BlameStats.cc \35 libsvndigest_la_SOURCES = AddStats.cc Alias.cc BlameStats.cc \ 36 36 ClassicStats.cc ColumnStream.cc \ 37 37 Commitment.cc Configuration.cc \ … … 47 47 48 48 clean-local: 49 rm -rf *~ subversion_info.h49 rm -rf *~ 50 50 51 51 all-local: … … 66 66 revision=`$(SVNVERSION) $(top_srcdir)` ;\ 67 67 year=`svn info $(top_srcdir)| sed -n 's/.*Date: \(.*\)-..-.*/\1/p'`;\ 68 echo $$year; \69 68 $(SED) -e 's/sub_2_svn_revision/'$$revision'/g' \ 70 69 -e 's/sub_2_svn_year/'$$year'/g' subversion_info.h.in >> $@ ; -
trunk/lib/StatsCollection.cc
r538 r543 24 24 #include "StatsCollection.h" 25 25 26 #include "AddStats.h" 26 27 #include "BlameStats.h" 27 28 #include "ClassicStats.h" … … 44 45 stats_["classic"] = new ClassicStats(path); 45 46 stats_["blame"] = new BlameStats(path); 47 stats_["add"] = new AddStats(path); 46 48 } 47 49
Note: See TracChangeset
for help on using the changeset viewer.