Changeset 1478
- Timestamp:
- May 29, 2012, 12:17:04 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/AddStats.cc
r1418 r1478 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson6 Copyright (C) 2009, 2010, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 26 26 #include "SVNblame.h" 27 27 #include "SVNlog.h" 28 #include "utility.h"29 28 30 29 #include <algorithm> … … 52 51 53 52 54 void AddStats::do_parse(const std::string& path, svn_revnum_t rev)53 void AddStats::do_parse(const std::string& path, svn_revnum_t first_rev) 55 54 { 55 first_rev = std::max(first_rev, ignore_rev()+1); 56 56 // FIXME: why not using the log from File object 57 57 SVNlog log(path); … … 60 60 std::vector<std::map<std::string, SparseVector> > data; 61 61 std::transform(log.commits().begin(), log.commits().end(), 62 std::inserter(revs, revs.begin()), 62 std::inserter(revs, revs.begin()), 63 63 std::mem_fun_ref(&Commitment::revision)); 64 64 for (RevSet::iterator rev_iter=revs.begin(); 65 rev_iter!=revs.end() && *rev_iter>= rev; ++rev_iter){65 rev_iter!=revs.end() && *rev_iter>=first_rev; ++rev_iter){ 66 66 SVNblame svn_blame(path, *rev_iter); 67 67 LineTypeParser parser(path); … … 101 101 102 102 103 unsigned int AddStats::max_element(const SumVector& v) const 103 unsigned int AddStats::max_element(const SumVector& v) const 104 104 { 105 105 if (v.size()==0) -
trunk/lib/BlameStats.cc
r1418 r1478 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson6 Copyright (C) 2009, 2010, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 24 #include "BlameStats.h" 25 25 26 #include "Functor.h"27 26 #include "SVNblame.h" 28 27 #include "SVNinfo.h" 29 28 #include "SVNlog.h" 30 #include "utility.h"31 29 #include "Vector.h" 32 30 … … 65 63 void BlameStats::do_parse(const std::string& path, svn_revnum_t first_rev) 66 64 { 65 first_rev = std::max(first_rev, ignore_rev()+1); 67 66 // FIXME: using log from File object 68 67 SVNlog log(path); … … 70 69 RevSet revs; 71 70 std::transform(log.commits().begin(), log.commits().end(), 72 std::inserter(revs, revs.begin()), 71 std::inserter(revs, revs.begin()), 73 72 std::mem_fun_ref(&Commitment::revision)); 74 73 // we use a ParseVector here to be able to detect when people are … … 83 82 assert(static_cast<size_t>(lt)<data.size()); 84 83 SparseVector& vec = data[lt][svn_blame.author()]; 85 vec.set(*rev_iter, vec[*rev_iter] + 1); 86 add_author(svn_blame.author()); 87 // I dont trust blame and log behave consistently (stop-on-copy). 88 revs.insert(svn_blame.revision()); 84 if (svn_blame.revision()>ignore_rev()) { 85 vec.set(*rev_iter, vec[*rev_iter] + 1); 86 add_author(svn_blame.author()); 87 // I dont trust blame and log behave consistently (stop-on-copy). 88 revs.insert(svn_blame.revision()); 89 } 89 90 svn_blame.next_line(); 90 91 } … … 100 101 typedef std::map<std::string,SparseVector>::const_iterator const_iterator; 101 102 for (const_iterator av = data[lt].begin(); av!=data[lt].end(); ++av) { 102 for (RevSet::const_reverse_iterator rev_iter=revs.rbegin(); 103 for (RevSet::const_reverse_iterator rev_iter=revs.rbegin(); 103 104 rev_iter!=revs.rend() && *rev_iter >= first_rev; ++rev_iter) { 104 105 stats_[lt][av->first].set(*rev_iter, data[lt][av->first][*rev_iter]); -
trunk/lib/ClassicStats.cc
r1418 r1478 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson6 Copyright (C) 2009, 2010, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 62 62 void ClassicStats::do_parse(const std::string& path, svn_revnum_t rev) 63 63 { 64 svn_revnum_t first_rev = ignore_rev() + 1; 64 65 reset(); 65 66 LineTypeParser parser(path); … … 69 70 LineTypeParser::line_type lt = parser.parse(svn_blame.line()); 70 71 assert(static_cast<size_t>(lt)<data.size()); 71 SparseVector& vec = data[lt][svn_blame.author()]; 72 vec.set(svn_blame.revision(), vec[svn_blame.revision()] + 1); 72 if (svn_blame.revision()>=first_rev) { 73 SparseVector& vec = data[lt][svn_blame.author()]; 74 vec.set(svn_blame.revision(), vec[svn_blame.revision()] + 1); 75 } 73 76 svn_blame.next_line(); 74 77 } -
trunk/lib/CopyrightStats.cc
r1457 r1478 2 2 3 3 /* 4 Copyright (C) 2011 Peter Johansson4 Copyright (C) 2011, 2012 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 60 60 ss << i->begin() << "-" << i->end(); 61 61 ss << ";"; 62 }62 } 63 63 config_ = ss.str(); 64 64 init(ignore_cache, year2rev); -
trunk/lib/File.cc
r1321 r1478 3 3 /* 4 4 Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2010 Peter Johansson5 Copyright (C) 2010, 2012 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 52 52 53 53 54 File::File(const unsigned int level, const std::string& path, 55 const std::string& output) 54 File::File(const unsigned int level, const std::string& path, 55 const std::string& output) 56 56 : Node(level,path,output) 57 57 { … … 70 70 71 71 std::string File::href(void) const 72 { 73 return name()+".html"; 72 { 73 return name()+".html"; 74 74 } 75 75 … … 92 92 93 93 94 const StatsCollection& File::parse(bool verbose, bool ignore) 94 const StatsCollection& File::parse(bool verbose, bool ignore, 95 svn_revnum_t ignore_rev) 95 96 { 96 97 if (verbose) 97 std::cout << "Parsing '" << path_ << "'" << std::endl; 98 std::cout << "Parsing '" << path_ << "'" << std::endl; 98 99 stats_.reset(); 100 stats_.ignore_rev(ignore_rev); 99 101 std::string cache_file = cache_name(); 100 102 std::string cache_dir = directory_name(cache_file); … … 107 109 is.close(); 108 110 } 109 else 111 else 110 112 stats_.parse(path_); 111 113 if (!node_exist(cache_dir)) -
trunk/lib/File.h
r1293 r1478 6 6 /* 7 7 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009, 2010 Peter Johansson8 Copyright (C) 2009, 2010, 2012 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 26 26 #include "Node.h" 27 27 28 #include <subversion-1/svn_types.h> 29 28 30 #include <string> 29 31 … … 36 38 { 37 39 public: 38 /// 39 /// @brief Default Constructor 40 /// 41 File(const unsigned int level, const std::string& path, 42 const std::string& output=""); 40 /// 41 /// @brief Default Constructor 42 /// 43 File(const unsigned int level, const std::string& path, 44 const std::string& output=""); 43 45 44 46 /** … … 67 69 /// @brief Parsing out information from svn repository 68 70 /// 71 /// if \a ignore true, ignore cache file (read from repo). 72 /// ignore revision in range [0, ignore_rev] 73 /// 69 74 /// @return Stats object of the file 70 75 /// 71 const StatsCollection& parse(bool verbose, bool ignore); 76 const StatsCollection& parse(bool verbose, bool ignore, 77 svn_revnum_t ignore_rev); 72 78 73 79 /** … … 92 98 93 99 #endif 94 95 -
trunk/lib/SVNproperty.cc
r1454 r1478 4 4 Copyright (C) 2006 Jari Häkkinen 5 5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2010 Peter Johansson6 Copyright (C) 2010, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 40 40 namespace svndigest { 41 41 42 using yat::utility::convert; 42 43 43 44 SVNproperty::SVNproperty(const std::string& path) 44 : binary_(false), svncopyright_ignore_(false), svndigest_ignore_ (false)45 : binary_(false), svncopyright_ignore_(false), svndigest_ignore_rev_(0) 45 46 { 46 47 typedef std::map<std::string, std::string> str_map; … … 61 62 try { 62 63 if (i->first == "svndigest:ignore") 63 svndigest_ignore_=true;64 add_svndigest_ignore(i->second); 64 65 else if (i->first == "svncopyright:ignore") 65 66 add_svncopyright_ignore(i->second); … … 102 103 trim(second); 103 104 yat::utility::Segment<svn_revnum_t> rev_interval; 104 using yat::utility::convert;105 105 if (!found_dash) { 106 106 rev_interval.begin() = convert<svn_revnum_t>(first); … … 122 122 123 123 124 void SVNproperty::add_svndigest_ignore(const std::string& value) 125 { 126 if (value.empty() || value=="*") { 127 svndigest_ignore_rev_ = std::numeric_limits<svn_revnum_t>::max(); 128 return; 129 } 130 svndigest_ignore_rev_ = convert<svn_revnum_t>(value); 131 } 132 133 124 134 bool SVNproperty::binary(void) const 125 135 { … … 130 140 bool SVNproperty::svndigest_ignore(void) const 131 141 { 132 return svndigest_ignore_; 142 return svndigest_ignore_rev_==std::numeric_limits<svn_revnum_t>::max(); 143 } 144 145 146 svn_revnum_t SVNproperty::svndigest_ignore_rev(void) const 147 { 148 return svndigest_ignore_rev_; 133 149 } 134 150 -
trunk/lib/SVNproperty.h
r1438 r1478 7 7 Copyright (C) 2006 Jari Häkkinen 8 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson9 Copyright (C) 2010, 2012 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 70 70 */ 71 71 bool svndigest_ignore(void) const; 72 svn_revnum_t svndigest_ignore_rev(void) const; 72 73 73 74 /** … … 101 102 102 103 void add_svncopyright_ignore(const std::string& value); 104 void add_svndigest_ignore(const std::string& value); 103 105 104 106 bool binary_; 105 107 bool svncopyright_ignore_; 106 bool svndigest_ignore_;107 108 yat::utility::SegmentSet<svn_revnum_t> svncopyright_ignore_rev_; 109 svn_revnum_t svndigest_ignore_rev_; 108 110 }; 109 111 -
trunk/lib/Stats.cc
r1378 r1478 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2010, 2011 Peter Johansson6 Copyright (C) 2010, 2011, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 50 50 51 51 Stats::Stats(const std::string& path) 52 : stats_(std::vector<Author2Vector>(LineTypeParser::total+1)) 52 : stats_(std::vector<Author2Vector>(LineTypeParser::total+1)), 53 ignore_rev_(0) 53 54 { 54 55 // Make sure latest revision is set properly … … 65 66 } 66 67 67 68 68 69 void Stats::add(const std::vector<std::map<std::string, SparseVector> >& data) 69 70 { … … 118 119 */ 119 120 /* 120 void Stats::add(const std::string& user, svn_revnum_t rev, 121 void Stats::add(const std::string& user, svn_revnum_t rev, 121 122 LineTypeParser::line_type lt, unsigned int n) 122 123 { … … 135 136 136 137 void Stats::add(SumVector& vec, svn_revnum_t rev, unsigned int n) 137 { 138 { 138 139 vec.set(rev, vec[rev] + n); 139 140 } … … 147 148 148 149 149 void Stats::add_authors(std::set<std::string>::const_iterator first, 150 void Stats::add_authors(std::set<std::string>::const_iterator first, 150 151 std::set<std::string>::const_iterator last) 151 152 { … … 218 219 219 220 221 std::string Stats::config_code(void) const 222 { 223 if (ignore_rev_==0) 224 return config_code_; 225 std::stringstream result(config_code_); 226 result << "ir" << ignore_rev_; 227 return result.str(); 228 } 229 230 220 231 unsigned int Stats::empty(const std::string& user) const 221 232 { … … 227 238 { 228 239 A2VConstIter iter(m.find(std::string(user))); 229 if (iter==m.end() || iter->second.empty()) 240 if (iter==m.end() || iter->second.empty()) 230 241 return 0; 231 242 return iter->second.back(); … … 233 244 234 245 235 const SumVector& Stats::get_vector(const Author2Vector& m, 246 const SumVector& Stats::get_vector(const Author2Vector& m, 236 247 const std::string& user) const 237 248 { 238 249 A2VConstIter iter(m.find(std::string(user))); 239 if (iter==m.end()) 250 if (iter==m.end()) 240 251 throw std::runtime_error(user+std::string(" not found i Stats")); 241 252 return iter->second; 253 } 254 255 256 void Stats::ignore_rev(svn_revnum_t rev) 257 { 258 ignore_rev_ = rev; 259 } 260 261 262 const svn_revnum_t& Stats::ignore_rev(void) const 263 { 264 return ignore_rev_; 242 265 } 243 266 … … 303 326 std::string line; 304 327 getline(is, line); 305 if (line!=config_code _) {328 if (line!=config_code()) { 306 329 std::cout << "cache file is for different configuration.\n" 307 << "config code: '" << config_code _<< "'\n"330 << "config code: '" << config_code() << "'\n" 308 331 << "config code in cache file: '" << line << "'\n" 309 332 << "retrieving statistics from repository.\n"; … … 342 365 343 366 344 void Stats::map_add(A2VConstIter first1, A2VConstIter last1, 367 void Stats::map_add(A2VConstIter first1, A2VConstIter last1, 345 368 Author2Vector& map) 346 369 { 347 370 A2VIter first2(map.begin()); 348 371 Author2Vector::key_compare compare; 349 while ( first1 != last1) { 372 while ( first1 != last1) { 350 373 // key of first1 less than key of first2 351 374 if (first2==map.end() || compare(first1->first,first2->first)) { … … 369 392 unsigned int Stats::max_element(const SumVector& vec) const 370 393 { 371 return std::max_element(vec.begin(), vec.end(), 394 return std::max_element(vec.begin(), vec.end(), 372 395 pair_value_compare<const svn_revnum_t, unsigned int>())->second; 373 396 } … … 380 403 calc_total(); 381 404 calc_all(); 382 405 383 406 assert(total_stats().size()); 384 407 assert(code_stats().size()); … … 394 417 // be used from load_cache8(). 395 418 os << "CACHE FILE VERSION 8\n"; 396 os << config_code _<< "\n";419 os << config_code() << "\n"; 397 420 os << last_changed_rev() << " "; 398 421 os << authors().size() << "\n"; 399 422 400 std::copy(authors().begin(), authors().end(), 423 std::copy(authors().begin(), authors().end(), 401 424 std::ostream_iterator<std::string>(os, "\n")); 402 425 os << cache_check_str() << "\n"; … … 454 477 455 478 456 svn_revnum_t Stats::revision(void) const 457 { 458 return revision_; 479 svn_revnum_t Stats::revision(void) const 480 { 481 return revision_; 459 482 } 460 483 … … 468 491 for (size_t i=0; i<stats_.size(); ++i) 469 492 map_add(rhs.stats_[i].begin(), rhs.stats_[i].end(), stats_[i]); 470 493 471 494 return *this; 472 495 } 473 496 474 475 size_t Stats::operator()(int linetype, std::string author, 497 498 size_t Stats::operator()(int linetype, std::string author, 476 499 svn_revnum_t rev) const 477 500 { … … 482 505 if (i==stats_[linetype].end()){ 483 506 std::stringstream msg; 484 msg << __FILE__ << ": author: " << author << " does not exist"; 507 msg << __FILE__ << ": author: " << author << " does not exist"; 485 508 throw std::runtime_error(msg.str()); 486 509 } -
trunk/lib/Stats.h
r1321 r1478 7 7 Copyright (C) 2005 Peter Johansson 8 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson9 Copyright (C) 2010, 2012 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 45 45 { 46 46 public: 47 /// 48 /// @brief Default Constructor 47 /// 48 /// @brief Default Constructor 49 49 /// 50 50 explicit Stats(const std::string& path); … … 61 61 62 62 /// 63 /// \return number of code lines for \a user for latest revision. 64 /// 65 unsigned int code(const std::string& user="all") const; 66 67 68 /// 69 /// \return number of comments lines for \a user for latest revision. 70 /// 71 unsigned int comments(const std::string& user="all") const; 72 73 /// 74 /// \return number of empty lines for \a user for latest revision. 75 /// 76 unsigned int empty(const std::string& user="all") const; 63 /// \return number of code lines for \a user for latest revision. 64 /// 65 unsigned int code(const std::string& user="all") const; 66 67 68 /// 69 /// \return number of comments lines for \a user for latest revision. 70 /// 71 unsigned int comments(const std::string& user="all") const; 72 73 /// 74 /// \return number of empty lines for \a user for latest revision. 75 /// 76 unsigned int empty(const std::string& user="all") const; 77 77 78 78 /// … … 84 84 /// \return number of lines for \a user for latest revision 85 85 /// 86 unsigned int lines(const std::string& user="all") const; 86 unsigned int lines(const std::string& user="all") const; 87 87 88 88 /** … … 109 109 /// @brief Clear all statistics 110 110 /// 111 void reset(void); 111 void reset(void); 112 112 113 113 /** … … 120 120 /// 121 121 svn_revnum_t revision(void) const; 122 123 /** 124 \brief set (greatest) revision to be ignored 125 */ 126 void ignore_rev(svn_revnum_t rev); 122 127 123 128 /** … … 146 151 147 152 void add_author(std::string); 148 void add_authors(std::set<std::string>::const_iterator, 153 void add_authors(std::set<std::string>::const_iterator, 149 154 std::set<std::string>::const_iterator); 150 155 151 156 // references to data 152 inline Author2Vector& code_stats(void) 157 inline Author2Vector& code_stats(void) 153 158 { return stats_[LineTypeParser::code]; } 154 inline Author2Vector& comment_stats(void) 159 inline Author2Vector& comment_stats(void) 155 160 { return stats_[LineTypeParser::comment]; } 156 inline Author2Vector& copyright_stats(void) 161 inline Author2Vector& copyright_stats(void) 157 162 { return stats_[LineTypeParser::copyright]; } 158 inline Author2Vector& other_stats(void) 163 inline Author2Vector& other_stats(void) 159 164 { return stats_[LineTypeParser::other]; } 160 inline Author2Vector& comment_or_copy_stats(void) 165 inline Author2Vector& comment_or_copy_stats(void) 161 166 { return stats_[LineTypeParser::comment_or_copy]; } 162 inline Author2Vector& total_stats(void) 167 inline Author2Vector& total_stats(void) 163 168 { return stats_[LineTypeParser::total]; } 164 169 … … 178 183 179 184 /** 185 const access to ignore_rev_ 186 */ 187 const svn_revnum_t& ignore_rev(void) const; 188 189 /** 180 190 add range [\a first, \a last) to \a map 181 191 */ 182 void map_add(Author2Vector::const_iterator first, 192 void map_add(Author2Vector::const_iterator first, 183 193 Author2Vector::const_iterator last, 184 194 Author2Vector& map); … … 186 196 std::set<std::string> authors_; 187 197 188 const SumVector& get_vector(const Author2Vector&, 198 const SumVector& get_vector(const Author2Vector&, 189 199 const std::string& user) const; 190 200 private: … … 196 206 197 207 /** 208 \return config_code unless ignore_rev_!=0 in which case 209 ignore_rev_ is appended to returned string 210 */ 211 std::string config_code(void) const; 212 213 /** 198 214 Parse statistics for fundamental categories, i.e., code, 199 215 comment, empty, and copyright for each author. Ignore revisions … … 201 217 */ 202 218 virtual void do_parse(const std::string&, svn_revnum_t first_rev)=0; 203 219 204 220 /// load cache file version 7 205 221 svn_revnum_t load_cache7(std::istream&); … … 209 225 // Change this string if cache format is changed in such a way 210 226 // that all old cache files are obsolete. 211 inline std::string cache_check_str(void) const 212 {return "CACHE FILE VERSION 7";} 227 inline std::string cache_check_str(void) const 228 {return "CACHE FILE VERSION 7";} 213 229 214 230 void calc_all(void); … … 223 239 in linear time. 224 240 225 \return the largest largest element in \a v. 226 */ 227 virtual unsigned int max_element(const SumVector& v) const; 241 \return the largest largest element in \a v. 242 */ 243 virtual unsigned int max_element(const SumVector& v) const; 228 244 229 245 void print(std::ostream& os, const Author2Vector& m) const; 230 246 247 svn_revnum_t ignore_rev_; 231 248 svn_revnum_t revision_; // Should be the latest revision for whole project 232 249 svn_revnum_t last_changed_rev_; // Should be the latest revision for file … … 241 258 }} // end of namespace svndigest end of namespace theplu 242 259 243 #endif 260 #endif -
trunk/lib/StatsCollection.cc
r1124 r1478 4 4 Copyright (C) 2007 Peter Johansson 5 5 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson6 Copyright (C) 2009, 2010, 2012 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 108 108 109 109 110 void StatsCollection::ignore_rev(svn_revnum_t rev) 111 { 112 for (map::const_iterator i(stats_.begin()); i!=stats_.end(); ++i) { 113 i->second->ignore_rev(rev); 114 } 115 } 116 117 110 118 const StatsCollection& StatsCollection::operator+=(const StatsCollection& rhs) 111 119 { … … 122 130 map::const_iterator iter = stats_.find(key); 123 131 if (iter==stats_.end()) 124 throw std::runtime_error(key + 132 throw std::runtime_error(key + 125 133 std::string(" not found in StatsCollection")); 126 134 return *(iter->second); -
trunk/lib/StatsCollection.h
r1081 r1478 7 7 Copyright (C) 2007 Peter Johansson 8 8 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson9 Copyright (C) 2010, 2012 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 27 27 #include "Stats.h" 28 28 29 #include <subversion-1/svn_types.h> 30 29 31 #include <map> 30 32 #include <string> … … 39 41 { 40 42 public: 41 /// 42 /// @brief Default Constructor 43 /// 44 /// @brief Default Constructor 43 45 /// 44 46 explicit StatsCollection(const std::string& path); … … 67 69 */ 68 70 void reset(void); 71 72 /** 73 */ 74 void ignore_rev(svn_revnum_t rev); 69 75 70 76 const std::map<std::string, Stats*>& stats(void) const; … … 97 103 }} // end of namespace svndigest end of namespace theplu 98 104 99 #endif 105 #endif -
trunk/lib/SvndigestVisitor.cc
r1449 r1478 2 2 3 3 /* 4 Copyright (C) 2010 Peter Johansson4 Copyright (C) 2010, 2012 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 28 28 #include "NodeVisitor.h" 29 29 30 #include <algorithm> 31 30 32 namespace theplu { 31 33 namespace svndigest { … … 39 41 bool SvndigestVisitor::enter(Directory& dir) 40 42 { 43 svn_revnum_t r = dir.property().svndigest_ignore_rev(); 44 if (ignore_rev_.size() && r<ignore_rev_.back()) 45 ignore_rev_.push_back(ignore_rev_.back()); 46 ignore_rev_.push_back(r); 41 47 if (dir.svndigest_ignore()) 42 48 return false; … … 47 53 void SvndigestVisitor::leave(Directory& dir) 48 54 { 55 assert(ignore_rev_.size()); 56 ignore_rev_.pop_back(); 49 57 if (report_) { 50 58 dir.collect_stats(); … … 58 66 void SvndigestVisitor::visit(File& file) 59 67 { 60 if (!file.svndigest_ignore()) 61 file.parse(verbose_, ignore_cache_); 68 if (!file.svndigest_ignore()) { 69 svn_revnum_t rev = file.property().svndigest_ignore_rev(); 70 assert(ignore_rev_.size()); 71 rev = std::max(rev, ignore_rev_.back()); 72 file.parse(verbose_, ignore_cache_, rev); 73 } 62 74 if (report_) { 63 75 file.init_tiny_stats(); -
trunk/lib/SvndigestVisitor.h
r1234 r1478 5 5 6 6 /* 7 Copyright (C) 2010 Peter Johansson7 Copyright (C) 2010, 2012 Peter Johansson 8 8 9 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 24 25 25 #include "NodeVisitor.h" 26 27 #include <subversion-1/svn_types.h> 28 29 #include <vector> 26 30 27 31 namespace theplu{ … … 54 58 bool ignore_cache_; 55 59 bool report_; 60 std::vector<svn_revnum_t> ignore_rev_; 56 61 }; 57 62 }} // end of namespace svndigest and namespace theplu -
trunk/test/Makefile.am
r1470 r1478 26 26 AM_DEFAULT_SOURCE_EXT = .cc 27 27 28 EXTRA_PROGRAMS = cache _partial.test color.test \28 EXTRA_PROGRAMS = cache.test cache_partial.test color.test \ 29 29 config.test copyright.test date.test \ 30 graph.test htmlstream.test \30 graph.test htmlstream.test ignore_rev.test \ 31 31 parser.test option.test stats.test svn_diff.test trac.test utility.test \ 32 32 vector.test … … 84 84 libsvndigesttest_a_SOURCES = Suite.cc 85 85 86 clean-local: 86 clean-local: 87 87 rm -rf generated_output toy_project testSubDir 88 88 89 mostlyclean-local: 90 rm -f *.png *.tmp *~ 89 mostlyclean-local: 90 rm -f *.png *.tmp *~ 91 91 92 92 .PHONY: lazycheck 93 93 94 lazycheck:; $(MAKE) $(AM_MAKEFLAGS) check RECHECK_LOGS= 94 lazycheck:; $(MAKE) $(AM_MAKEFLAGS) check RECHECK_LOGS= 95 95 96 96 if HAVE_SVN_WC 97 repo_stamp = $(srcdir)/repo/db/current 97 repo_stamp = $(srcdir)/repo/db/current svn_update.sh 98 98 else 99 99 repo_stamp = … … 109 109 link_root_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) $(repo_stamp) 110 110 permission_test.log:init.sh $(top_builddir)/bin/svncopyright$(EXEEXT) $(repo_stamp) 111 repo_status_test.log:init.sh 111 repo_status_test.log:init.sh 112 112 repo_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) $(repo_stamp) 113 113 svncopyright_test.log:init.sh $(top_builddir)/bin/svncopyright$(EXEEXT) … … 118 118 copyright.log: $(repo_stamp) 119 119 stats.log: $(repo_stamp) 120 -
trunk/test/Suite.cc
r1435 r1478 3 3 /* 4 4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson5 Copyright (C) 2009, 2010, 2012 Peter Johansson 6 6 7 7 This file is part of the yat library, http://dev.thep.lu.se/yat … … 31 31 32 32 #include <algorithm> 33 #include <cstdlib> 33 34 #include <fstream> 34 35 #include <iostream> 35 36 #include <iterator> 37 #include <sstream> 38 #include <stdexcept> 36 39 #include <string> 37 40 … … 301 304 { 302 305 std::string cmd = abs_builddir()+"/svn_update.sh"; 303 out() << cmd << std::endl; 304 int status = system(cmd.c_str()); 305 if (status) { 306 out() << "failed with status: " << status << std::endl; 306 try { 307 system(cmd, 0); 308 } 309 catch (std::runtime_error& e) { 310 out() << e.what() << "\n"; 307 311 exit (1); 308 312 } … … 329 333 330 334 335 void Suite::system(const std::string& cmd, int ret) const 336 { 337 int status = ::system(cmd.c_str()); 338 out() << "call: '" << cmd << "'\n"; 339 if (status==ret) 340 return; 341 std::stringstream ss; 342 ss << "error: status: " << status; 343 throw std::runtime_error(ss.str()); 344 } 331 345 }}} -
trunk/test/Suite.h
r1207 r1478 6 6 /* 7 7 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009, 2010 Peter Johansson8 Copyright (C) 2009, 2010, 2012 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 64 64 65 65 /** 66 Wrapper around std system that calls \a cmd to shell. If return 67 value is different from \a xret exception is thrown 68 */ 69 void system(const std::string& cmd, int xret=0) const; 70 71 /** 66 72 \return true if we are running in verbose mode 67 73 */ … … 102 108 */ 103 109 std::string src_filename(const std::string& path); 110 111 104 112 }}} 105 113 -
trunk/test/cache_partial.cc
r1321 r1478 2 2 3 3 /* 4 Copyright (C) 2009, 2010 Peter Johansson4 Copyright (C) 2009, 2010, 2012 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 54 54 std::string cache_file = "toy_project/.svndigest/AUTHORS.svndigest-cache"; 55 55 File file(0,filename,""); 56 const StatsCollection& stats1 = file.parse(suite.verbose(), true );56 const StatsCollection& stats1 = file.parse(suite.verbose(), true, 0); 57 57 suite.add(test::consistent(stats1, suite)); 58 58 … … 60 60 copy_file(test::src_filename("data/AUTHORS.svndigest-cache-r61"), cache_file); 61 61 File file2(0,filename,""); 62 const StatsCollection& stats2 = file2.parse(suite.verbose(), false );62 const StatsCollection& stats2 = file2.parse(suite.verbose(), false, 0); 63 63 suite.add(test::consistent(stats2, suite)); 64 64
Note: See TracChangeset
for help on using the changeset viewer.