Changeset 1232
- Timestamp:
- Oct 23, 2010, 4:06:06 PM (12 years ago)
- Location:
- branches/visitor/lib
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/visitor/lib/CopyrightVisitor.cc
r1229 r1232 57 57 file.parse(verbose_, ignore_cache_); 58 58 file.print_copyright(alias_, verbose_, year2rev_); 59 file.stats().reset(); 59 60 } 60 61 -
branches/visitor/lib/Directory.cc
r1230 r1232 30 30 #include "SVN.h" 31 31 #include "SVNlog.h" 32 #include "TinyStats.h" 32 33 #include "utility.h" 33 34 … … 101 102 102 103 103 bool Directory::dir(void) const104 {105 return true;106 }107 108 109 104 void Directory::gather_stats(void) 110 105 { 111 106 stats_.reset(); 112 107 for (NodeIterator i=daughters_.begin(); i!=daughters_.end(); ++i) 113 if (!(*i)->ignore()) 108 if (!(*i)->ignore()) { 114 109 stats_ += (*i)->stats(); 110 (*i)->stats().reset(); 111 } 112 } 113 114 115 bool Directory::dir(void) const 116 { 117 return true; 115 118 } 116 119 … … 151 154 { 152 155 stats_.reset(); 156 assert(0 && "we are not using this function, are we?"); 153 157 /* 154 158 for (NodeIterator i=daughters_.begin(); i!=daughters_.end(); ++i) -
branches/visitor/lib/Directory.h
r1230 r1232 61 61 ~Directory(void); 62 62 63 /** 64 Collect stats from daughter nodes and reset stats in daughter 65 nodes. 66 */ 67 void collect_stats(void); 68 63 69 /// 64 70 /// @return true 65 71 /// 66 72 bool dir(void) const; 67 68 /**69 Collect stats from daughter nodes.70 */71 void gather_stats(void);72 73 73 74 /// -
branches/visitor/lib/File.cc
r1230 r1232 34 34 #include "SVNblame.h" 35 35 #include "SVNlog.h" 36 #include "TinyStats.h" 36 37 37 38 #include <algorithm> -
branches/visitor/lib/Makefile.am
r1230 r1232 39 39 Stats.h StatsCollection.h subversion_info.h \ 40 40 SvndigestVisitor.h SVN.h SVNblame.h \ 41 SVNdiff.h SVNinfo.h SVNlog.h SVNproperty.h Trac.h utility.h Vector.h 41 SVNdiff.h SVNinfo.h SVNlog.h SVNproperty.h TinyStats.h \ 42 Trac.h utility.h Vector.h 42 43 43 44 libsvndigest_a_SOURCES = AddStats.cc Alias.cc BlameStats.cc \ … … 50 51 rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc \ 51 52 SVNblame.cc SVNdiff.cc SvndigestVisitor.cc SVNinfo.cc \ 52 SVNlog.cc SVNproperty.cc \53 SVNlog.cc SVNproperty.cc TinyStats.cc \ 53 54 Trac.cc utility.cc Vector.cc 54 55 -
branches/visitor/lib/Node.cc
r1230 r1232 27 27 #include "HtmlStream.h" 28 28 #include "html_utility.h" 29 #include "LineTypeParser.h" 29 30 #include "SVNlog.h" 30 31 #include "SVNproperty.h" … … 95 96 const std::string& user) const 96 97 { 97 const Stats& stats = stats_[stats_type];98 98 os << "<tr class=\"" << css_class << "\">\n" 99 99 << "<td class=\"" << node_type() << "\">"; … … 105 105 os << name() << " (<i>link</i>)"; 106 106 // there is no output for nodes when user has zero contribution 107 else if (user!="all" && ! stats.lines(user))107 else if (user!="all" && !tiny_stats_(stats_type,user,LineTypeParser::total)) 108 108 os << name(); 109 109 else if (!Configuration::instance().output_file() && !this->dir()) … … 112 112 os << anchor(href(), name()); 113 113 os << "</td>\n"; 114 if (user=="all") { 115 os << "<td>" << stats.lines() << "</td>\n" 116 << "<td>" << stats.code() << "</td>\n" 117 << "<td>" << stats.comments() << "</td>\n" 118 << "<td>" << stats.empty() << "</td>\n"; 119 } 120 else { 121 os << "<td>" << stats.lines(user); 122 if (stats.lines(user)) 123 os << " (" << percent(stats.lines(user),stats.lines()) << "%)"; 124 os << "</td>\n"; 125 os << "<td>" << stats.code(user); 126 if (stats.code(user)) 127 os << " (" << percent(stats.code(user),stats.code()) << "%)"; 128 os << "</td>\n"; 129 os << "<td>" << stats.comments(user); 130 if (stats.comments(user)) 131 os << " (" << percent(stats.comments(user),stats.comments()) << "%)"; 132 os << "</td>\n"; 133 os << "<td>" << stats.empty(user); 134 if (stats.empty(user)) 135 os << " (" << percent(stats.empty(user),stats.empty()) << "%)"; 136 os << "</td>\n"; 137 138 } 139 114 115 std::cerr << "table row: " << path() << std::endl; 116 117 html_tabletd(os, stats_type, user, LineTypeParser::total); 118 html_tabletd(os, stats_type, user, LineTypeParser::code); 119 html_tabletd(os, stats_type, user, LineTypeParser::comment); 120 html_tabletd(os, stats_type, user, LineTypeParser::other); 121 140 122 os << "<td>" << trac_revision(last_changed_rev()) << "</td>\n" 141 123 << "<td>" << author() << "</td>\n" 142 124 << "</tr>\n"; 125 } 126 127 128 void Node::html_tabletd(std::ostream& os, const std::string& stats_type, 129 const std::string& user, 130 LineTypeParser::line_type lt) const 131 { 132 os << "<td>" << tiny_stats_(stats_type, user, lt); 133 if (user!="all" && tiny_stats_(stats_type, user, lt)) 134 os << " (" << percent(tiny_stats_(stats_type, user, lt), 135 tiny_stats_(stats_type, "all", lt)) << "%)"; 136 os << "</td>\n"; 137 } 138 139 140 void Node::init_tiny_stats(void) 141 { 142 tiny_stats_.init(stats_); 143 143 } 144 144 … … 333 333 334 334 335 StatsCollection& Node::stats(void) 336 { 337 return stats_; 338 } 339 340 335 341 bool Node::svncopyright_ignore(void) const 336 342 { -
branches/visitor/lib/Node.h
r1230 r1232 26 26 27 27 #include "html_utility.h" 28 #include "LineTypeParser.h" 28 29 #include "StatsCollection.h" 29 30 #include "SVNinfo.h" 30 31 #include "SVNlog.h" 32 #include "TinyStats.h" 31 33 #include "utility.h" 32 34 … … 109 111 { return binary_ || svndigest_ignore_ || link_; } 110 112 113 /** 114 Create the TinyStats based on the stored CollectionStats 115 */ 116 void init_tiny_stats(void); 117 111 118 /// 112 119 /// @brief Get the revision number of the latest commit. … … 203 210 */ 204 211 const StatsCollection& stats(void) const; 212 213 StatsCollection& stats(void); 205 214 206 215 /** … … 228 237 static std::string project_; 229 238 StatsCollection stats_; 239 TinyStats tiny_stats_; 230 240 231 241 private: … … 234 244 /// 235 245 Node(const Node&); 246 247 void html_tabletd(std::ostream&, const std::string& stats_type, 248 const std::string& user, 249 LineTypeParser::line_type lt) const; 236 250 237 251 virtual void log_core(SVNlog&) const=0; -
branches/visitor/lib/SvndigestVisitor.cc
r1230 r1232 46 46 { 47 47 if (report_) { 48 dir.gather_stats(); 48 dir.collect_stats(); 49 dir.init_tiny_stats(); 49 50 dir.print(verbose_); 50 51 } … … 54 55 void SvndigestVisitor::visit(File& file) 55 56 { 56 if (file.ignore()) 57 return; 58 file.parse(verbose_, ignore_cache_); 59 if (report_) 60 file.print(verbose_); 57 if (!file.ignore()) 58 file.parse(verbose_, ignore_cache_); 59 if (report_) { 60 file.init_tiny_stats(); 61 if (!file.ignore()) 62 file.print(verbose_); 63 } 61 64 } 62 65
Note: See TracChangeset
for help on using the changeset viewer.