Changeset 1255
- Timestamp:
- Nov 1, 2010, 4:31:50 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/svndigest.cc
r1254 r1255 202 202 203 203 204 void set_dates(const std::string& repo, bool verbose) 205 { 206 if (verbose) 207 std::cout << "Retrieving dates" << std::endl; 208 SVNlog log(repo); 209 std::vector<time_t> dates; 210 dates.reserve(log.commits().size()); 204 void set_dates(const svndigest::SVNlog& log) 205 { 206 assert(!log.commits().empty()); 207 // all plots uses the same xmin 208 Graph::rev_min(log.commits().begin()->revision()); 209 210 /* 211 Fill in dates for revisions in log. Revisions not seen in log 212 should not be used and left equal to 0. 213 */ 214 std::vector<time_t> dates(log.latest_commit().revision()+1, 0); 211 215 for (SVNlog::container::const_iterator iter=log.commits().begin(); 212 216 iter!=log.commits().end(); ++iter) { 213 assert(static_cast<svn_revnum_t>(dates.size())==iter->revision()); 214 dates.push_back(Date(iter->date()).seconds()); 215 } 217 assert(iter->revision()<static_cast<svn_revnum_t>(dates.size())); 218 dates[iter->revision()] = Date(iter->date()).seconds(); 219 } 220 216 221 // all plots uses the same dates 217 222 Graph::set_dates(dates); … … 229 234 } 230 235 231 if (!option.revisions()) 232 set_dates(repo, option.verbose()); 236 if (!option.revisions()) { 237 if (option.verbose()) 238 std::cout << "Retrieving dates" << std::endl; 239 set_dates(tree.log()); 240 } 233 241 234 242 chdir(option.targetdir()); -
trunk/lib/Graph.cc
r1202 r1255 26 26 27 27 #include <algorithm> 28 #include <cassert> 28 29 #include <cmath> 29 30 #include <sstream> … … 32 33 namespace svndigest { 33 34 35 svn_revnum_t Graph::rev_min_=0; 34 36 std::vector<time_t> Graph::xticks_; 35 37 … … 90 92 #ifdef HAVE_PLPLOT 91 93 if (!plots_) { 92 // date[0] is not the oldest when repo is imported with cvs2svn 93 xmin_= date_xticks() ? std::min(xticks_[0], xticks_[1]) : 0; 94 assert(!date_xticks() || rev_min_<xticks_.size()); 95 assert(!date_xticks() || xticks_[rev_min_]); 96 xmin_= date_xticks() ? xticks_[rev_min_] : 0; 94 97 xmax_= date_xticks() ? xticks_.back() : y.size(); 95 98 xrange_=xmax_-xmin_; … … 117 120 118 121 SumVector::const_iterator iter = y.begin(); 119 svn_revnum_t x0= 0;122 svn_revnum_t x0=rev_min_; 120 123 PLFLT y0=0; 121 124 for (; iter!=y.end(); ++iter) { … … 162 165 163 166 167 void Graph::rev_min(svn_revnum_t rev) 168 { 169 rev_min_ = rev; 170 } 171 172 164 173 void Graph::set_dates(const std::vector<time_t>& date) 165 174 { … … 174 183 PLFLT x1 = rev1; 175 184 if (date_xticks()) { 185 assert(rev0<xticks_.size()); 186 assert(xticks_[rev0]); 176 187 x0 = xticks_[rev0]; 188 assert(rev1<xticks_.size()); 189 assert(xticks_[rev1]); 177 190 x1 = xticks_[rev1]; 178 191 } -
trunk/lib/Graph.h
r1198 r1255 27 27 28 28 #include "Vector.h" 29 30 #include <subversion-1/svn_types.h> 29 31 30 32 #include <ctime> … … 98 100 99 101 /** 102 Sets the left end of xrange to correspond to revision \a rev. 103 */ 104 static void rev_min(svn_revnum_t rev); 105 106 /** 100 107 \brief Function setting the dates. 101 108 … … 144 151 unsigned int plots_; // keep track of number of plots drawn 145 152 plstream pls_; 153 static svn_revnum_t rev_min_; 146 154 std::string timeformat_; 147 155 std::string title_; -
trunk/lib/Stats.cc
r1231 r1255 442 442 // FIXME: try keep a const& to avoid copying 443 443 SumVector total=get_vector(*stat, "all"); 444 total.resize(revision() );444 total.resize(revision()+1); 445 445 double yrange_max=1.03 * max_element(total) +1.0; 446 446 gp.ymax(yrange_max); … … 454 454 // FIXME: avoid this copying? 455 455 SumVector vec = get_vector(*stat,*i); 456 vec.resize(revision() );456 vec.resize(revision()+1); 457 457 if (max_element(vec)) { 458 458 author_cont.push_back(std::make_pair(*i,vec));
Note: See TracChangeset
for help on using the changeset viewer.