Changeset 1276 for branches/0.9-stable
- Timestamp:
- Nov 5, 2010, 1:24:26 PM (13 years ago)
- Location:
- branches/0.9-stable
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9-stable/bin/svndigest.cc
r1272 r1276 44 44 #include "yat/OptionArg.h" 45 45 46 #include <algorithm> 46 47 #include <cassert> 47 48 #include <cstdlib> … … 203 204 204 205 205 void set_dates(const svndigest::SVNlog& log, svn_revnum_t last_rev) 206 { 207 assert(!log.commits().empty()); 208 // all plots uses the same xmin 209 Graph::rev_min(log.commits().begin()->revision()); 210 206 void set_dates(const svndigest::SVNlog& log) 207 { 211 208 // Fill in dates for revisions in log. 212 std::vector<time_t> dates(l ast_rev+1, 0);209 std::vector<time_t> dates(log.latest_commit().revision()+1, 0); 213 210 for (SVNlog::container::const_iterator iter=log.commits().begin(); 214 211 iter!=log.commits().end(); ++iter) { … … 240 237 } 241 238 239 if (option.verbose()) 240 std::cout << "Retrieving log information" << std::endl; 241 assert(!tree.log().commits().empty()); 242 Graph::rev_min(tree.log().commits().begin()->revision()); 243 Graph::rev_max(tree.log().latest_commit().revision()); 242 244 if (!option.revisions()) { 243 if (option.verbose()) 244 std::cout << "Retrieving dates" << std::endl; 245 // Note that last_changed_rev might be larger than lastest rev in log 246 set_dates(tree.log(), tree.last_changed_rev()); 245 set_dates(tree.log()); 247 246 } 248 247 -
branches/0.9-stable/lib/AddStats.cc
r1194 r1276 103 103 unsigned int AddStats::max_element(const SumVector& v) const 104 104 { 105 assert(v.size()); 105 if (v.size()==0) 106 return 0; 106 107 return v.back(); 107 108 } -
branches/0.9-stable/lib/ClassicStats.cc
r1194 r1276 81 81 ClassicStats::max_element(const SumVector& v) const 82 82 { 83 assert(v.size()); 83 if (v.size()==0) 84 return 0; 84 85 return v.back(); 85 86 } -
branches/0.9-stable/lib/Graph.cc
r1275 r1276 32 32 namespace svndigest { 33 33 34 svn_revnum_t Graph::rev_max_=0; 34 35 svn_revnum_t Graph::rev_min_=0; 35 36 std::vector<time_t> Graph::xticks_; … … 93 94 assert(!date_xticks() || rev_min_<xticks_.size()); 94 95 assert(!date_xticks() || xticks_[rev_min_]); 95 xmin_= date_xticks() ? xticks_[rev_min_] : 0; 96 xmax_= date_xticks() ? xticks_.back() : y.size(); 96 assert(rev_min_<xticks_.size() || !date_xticks()); 97 xmin_= date_xticks() ? xticks_[rev_min_] : rev_min_; 98 assert(rev_max_<xticks_.size() || !date_xticks()); 99 xmax_= date_xticks() ? xticks_[rev_max_] : rev_max_; 97 100 xrange_=xmax_-xmin_; 98 101 yrange_=ymax_-ymin_; … … 126 129 y0 = iter->second; 127 130 } 128 svn_revnum_t xlast=date_xticks() ? xticks_.size() : y.size(); 129 --xlast; 130 staircase(x0, y0, xlast, y0); 131 staircase(x0, y0, rev_max_, y0); 131 132 132 133 legend_data legend; … … 166 167 167 168 169 void Graph::rev_max(svn_revnum_t rev) 170 { 171 rev_max_ = rev; 172 } 173 174 168 175 void Graph::rev_min(svn_revnum_t rev) 169 176 { -
branches/0.9-stable/lib/Graph.h
r1255 r1276 100 100 101 101 /** 102 Sets the right end of xrange to correspond to revision \a rev. 103 */ 104 static void rev_max(svn_revnum_t rev); 105 106 /** 102 107 Sets the left end of xrange to correspond to revision \a rev. 103 108 */ … … 152 157 plstream pls_; 153 158 static svn_revnum_t rev_min_; 159 static svn_revnum_t rev_max_; 154 160 std::string timeformat_; 155 161 std::string title_; -
branches/0.9-stable/lib/Node.h
r1264 r1276 207 207 std::string url(void) const; 208 208 209 inline const SVNinfo& svn_info(void) const { return svninfo_; } 210 209 211 protected: 210 212 /// … … 212 214 /// 213 215 void path_anchor(std::ostream& os) const; 214 215 inline const SVNinfo& svn_info(void) const { return svninfo_; }216 216 217 217 unsigned int level_; -
branches/0.9-stable/lib/Stats.cc
r1255 r1276 440 440 assert(stat->size()); 441 441 assert(stat->find("all")!=stat->end()); 442 // FIXME: try keep a const& to avoid copying 443 SumVector total=get_vector(*stat, "all"); 444 total.resize(revision()+1); 442 const SumVector& total=get_vector(*stat, "all"); 445 443 double yrange_max=1.03 * max_element(total) +1.0; 446 444 gp.ymax(yrange_max); … … 452 450 i != authors_.end(); ++i) { 453 451 assert(stat->find(*i)!=stat->end()); 454 // FIXME: avoid this copying? 455 SumVector vec = get_vector(*stat,*i); 456 vec.resize(revision()+1); 452 const SumVector& vec = get_vector(*stat,*i); 457 453 if (max_element(vec)) { 458 454 author_cont.push_back(std::make_pair(*i,vec));
Note: See TracChangeset
for help on using the changeset viewer.