Changeset 80
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Node.h
r79 r80 22 22 /// @brief Constructor 23 23 /// 24 Node(const std::string& path, const std::string& output="") : path_(path) 24 Node(const std::string& path, const std::string& output="") 25 : path_(path), stats_(path) 25 26 { output_name_ = output + name(); } 26 27 -
trunk/lib/Stats.cc
r78 r80 22 22 namespace svnstat{ 23 23 24 u_int Stats::latest_revision_=0; 24 25 Stats::Stats(const std::string& path) 26 { 27 // Make sure latest revision is set properly 28 std::map<std::string,std::string> svn_info = info(path); 29 std::stringstream ss; 30 ss << (svn_info.count("Revision") ? svn_info["Revision"] : "0"); 31 ss >> latest_revision_; 32 } 33 25 34 26 35 std::vector<u_int> Stats::accumulated(void) const … … 56 65 std::vector<u_int>* vec = &(map_[user]); 57 66 if (vec->size() < rev+1){ 58 vec->reserve( rev+1);67 vec->reserve(latest_revision_ + 1); 59 68 vec->insert(vec->end(), rev - vec->size(),0); 60 69 vec->push_back(1); 61 latest_revision_ = std::max(latest_revision_,rev);62 70 } 63 71 else -
trunk/lib/Stats.h
r74 r80 22 22 /// @brief Default Constructor 23 23 /// 24 inline Stats(void) {}24 explicit Stats(const std::string& path); 25 25 26 26 /// … … 70 70 void add(const std::string& user, const u_int& revision); 71 71 72 static u_int latest_revision_; // latest revision for whole project 72 73 u_int latest_revision_; // Should be the latest revision for whole project 73 74 74 75 // Peter, if the vector is sparse make it a map -
trunk/lib/utility.cc
r62 r80 14 14 int blame(const std::string& path) 15 15 { 16 std::string system_call = "svn blame " + path + " > svnstat.tmp";16 std::string system_call="svn blame " + path + " 1> svnstat.tmp 2> /dev/null"; 17 17 int system_return = system(system_call.c_str()); 18 18 if (system_return) … … 23 23 std::map<std::string, std::string> info(const std::string& path) 24 24 { 25 std::string system_call = "svn info " + path + " > svnstat.tmp";25 std::string system_call="svn info " + path + " 1> svnstat.tmp 2> /dev/null"; 26 26 int system_return = system(system_call.c_str()); 27 if (system_return){ 28 // Jari, throw exception. 29 std::cerr << "svnstat: svn info " << path << std::endl; 30 exit(-1); 31 } 27 if (system_return) 28 return std::map<std::string, std::string>(); 32 29 33 30 std::ifstream is("svnstat.tmp");
Note: See TracChangeset
for help on using the changeset viewer.