- Timestamp:
- Jan 20, 2006, 12:07:36 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/svnstat.cc
r60 r63 39 39 CommitStat cs; 40 40 cs.parse(option.root()); 41 assert(cs.date()[0].size()); 41 42 Stats::gnuplot_pipe_.set_dates(cs.date()); 42 43 -
trunk/lib/CommitStat.cc
r61 r63 33 33 typedef std::vector<std::string>::iterator DateIter; 34 34 size_t rev_last_iteration=0; 35 std::string date; 35 36 while (getline(is,line, '\n')){ 36 37 if (!line.size()) // skip empty line … … 42 43 ss >> revision; 43 44 assert(revision); 44 45 45 std::string tmp; 46 46 ss >> tmp; … … 48 48 ss >> user; 49 49 ss >> tmp; 50 std::string date;51 50 ss >> date; 52 51 std::string time; … … 55 54 if (revision+1 > date_.size()){ 56 55 date_.resize(revision+1); 57 rev_last_iteration=revision ;56 rev_last_iteration=revision+1; 58 57 } 59 58 assert(revision<=rev_last_iteration); 60 std:: copy(date_.begin()+revision,59 std::fill(date_.begin()+revision, 61 60 date_.begin()+rev_last_iteration, 62 date _.begin()+revision);61 date); 63 62 rev_last_iteration=revision; 64 63 } 65 std:: copy(date_.begin(),64 std::fill(date_.begin(), 66 65 date_.begin()+rev_last_iteration, 67 date _.begin());66 date); 68 67 } 69 68 is.close(); 70 69 71 70 return system_return; 72 71 } 73 72 74 73 74 void CommitStat::reset(void) 75 { 76 date_.clear(); 77 } 78 75 79 }} // end of namespace svnstat and namespace theplu -
trunk/lib/CommitStat.h
r61 r63 21 21 inline CommitStat(void) {} 22 22 23 inline const std::vector<std::string>& dates(void) { return date_; } 24 23 25 /// 24 26 /// Function parsing output from log() \a path'. … … 36 38 int log(const std::string& path) const; 37 39 38 inline void reset(void) {};40 void reset(void); 39 41 40 42 std::vector<std::string> date_; 43 41 44 }; 42 45 }} -
trunk/lib/Directory.cc
r60 r63 83 83 print_header(os); 84 84 os << std::endl; 85 stats_.print(os );85 stats_.print(os,output_name()+".png"); 86 86 os << std::endl; 87 87 -
trunk/lib/File.cc
r60 r63 38 38 print_header(os); 39 39 os << std::endl; 40 stats_.print(os );40 stats_.print(os,output_name()+".png"); 41 41 os << std::endl; 42 42 print_footer(os); -
trunk/lib/Gnuplot.cc
r60 r63 64 64 command("set timefmt '" + date_input_format_ + "'"); 65 65 command("set format x '" + format + "'"); 66 assert(date_[0].size()); 67 assert(y.back()); 66 68 plot(y,date_,"plot"); 67 69 } -
trunk/lib/Gnuplot.h
r60 r63 10 10 #include <string> 11 11 #include <vector> 12 12 13 13 14 namespace theplu { … … 65 66 /// 66 67 void date_plot(const std::vector<double>& y, 67 const std::string& format="%y-%b ");68 const std::string& format="%y-%b-%d"); 68 69 /// 69 70 /// 70 71 /// 71 72 void date_replot(const std::vector<double>& y, 72 const std::string& format="%y-%b ");73 const std::string& format="%y-%b-%d"); 73 74 74 75 /// … … 157 158 tmp.close(); 158 159 std::string cmdstring(plotcmd + " '" + name + "' u 1:2 title '" + 159 linetitle_ + "' with " + linestyle_ + "\n"); 160 linetitle_ + "' with " + linestyle_ + "\n"); 161 if (x.empty()) 162 cmdstring = plotcmd + " '" + name + "' u 1 title '" + 163 linetitle_ + "' with " + linestyle_ + "\n"; 164 160 165 command(cmdstring); 161 162 166 // need to keep track of created files since the gnuplot command 163 167 // is not executed until pclose on MacOSX, shouldn't the fflush -
trunk/lib/Stats.cc
r60 r63 6 6 7 7 #include <algorithm> 8 #include <cstdlib> 8 9 #include <iostream> 9 10 #include <map> … … 14 15 #include <utility> 15 16 #include <vector> 17 16 18 17 19 namespace theplu{ … … 31 33 std::vector<double> accum(sum.size()); 32 34 std::partial_sum(sum.begin(),sum.end(),accum.begin()); 35 assert(sum.size()==accum.size()); 33 36 return accum; 34 37 } … … 106 109 107 110 108 std::string Stats::plot( void) const111 std::string Stats::plot(const std::string& name) const 109 112 { 110 char name[]="svnstat_XXXXXX.png";111 if (mkstemps(name,4)==-1){112 throw std::runtime_error(std::string("Failed to get unique filename: ") +113 name);114 }115 113 std::string cmd=std::string("set term png; set output '")+name+"'"; 116 114 gnuplot_pipe_.command(cmd); -
trunk/lib/Stats.h
r60 r63 34 34 /// @brief Print statistics 35 35 /// 36 void inline print(std::ostream& s ) const37 { s << "<p><img src='" << plot( ) << "' alt='[plot]' border=0></p>\n"; }36 void inline print(std::ostream& s, const std::string& name) const 37 { s << "<p><img src='" << plot(name) << "' alt='[plot]' border=0></p>\n"; } 38 38 39 39 /// … … 78 78 void add(const std::string& user, const u_int& revision); 79 79 80 std::string plot( void) const;80 std::string plot(const std::string&) const; 81 81 82 82 static u_int latest_revision_; // latest rev. for whole project
Note: See TracChangeset
for help on using the changeset viewer.