- Timestamp:
- Jan 19, 2006, 2:32:57 PM (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/CommitStat.cc
r60 r61 1 1 2 //$Id$ 2 3 … … 14 15 int CommitStat::log(const std::string& path) const 15 16 { 16 std::string system_call = "svn log -q " + path + " > svnstat.log.tmp";17 std::cout << system_call << std::endl;18 17 std::string system_call = "svn log -q -r HEAD:1 " + path + 18 " > svnstat.log.tmp"; 19 int system_return = system(system_call.c_str()); 19 20 if (system_return) 20 21 std::cerr << "Error: svn log " << path << std::endl; … … 30 31 std::ifstream is("svnstat.log.tmp"); 31 32 std::string line; 33 typedef std::vector<std::string>::iterator DateIter; 34 size_t rev_last_iteration=0; 32 35 while (getline(is,line, '\n')){ 33 36 if (!line.size()) // skip empty line … … 38 41 size_t revision; 39 42 ss >> revision; 43 assert(revision); 44 40 45 std::string tmp; 41 46 ss >> tmp; … … 48 53 ss >> time; 49 54 50 date_.resize(std::max(revision+1, date_.size())); 51 date_[revision] = date; 55 if (revision+1 > date_.size()){ 56 date_.resize(revision+1); 57 rev_last_iteration=revision; 58 } 59 assert(revision<=rev_last_iteration); 60 std::copy(date_.begin()+revision, 61 date_.begin()+rev_last_iteration, 62 date_.begin()+revision); 63 rev_last_iteration=revision; 52 64 } 65 std::copy(date_.begin(), 66 date_.begin()+rev_last_iteration, 67 date_.begin()); 53 68 } 54 69 is.close(); 55 70 56 for(std::vector<std::string>::reverse_iterator i=date_.rbegin();57 i!=date_.rend(); ++i)58 if (i->empty()){59 assert(i!=date_.rbegin());60 *i = *(i-1);61 }62 63 71 return system_return; 64 72 } -
trunk/lib/CommitStat.h
r60 r61 22 22 23 23 /// 24 /// Function parsing output from 'svn log\a path'.24 /// Function parsing output from log() \a path'. 25 25 /// 26 26 /// @return return value from system call … … 32 32 private: 33 33 /// 34 /// @return return value from 'svn log \a path'34 /// @return return value from 'svn log -q -r 1:HEAD \a path' 35 35 /// 36 36 int log(const std::string& path) const;
Note: See TracChangeset
for help on using the changeset viewer.