Changeset 452
- Timestamp:
- Aug 17, 2007, 9:03:32 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/svndigest.cc
r439 r452 164 164 +tree->name()+"'"); 165 165 print_css("svndigest.css"); 166 SVNlog local_log(option->root()); 167 print_main_page(tree->name(), local_log, stats, 168 tree->url()); 166 print_main_page(tree->name(), tree->log(), stats, tree->url()); 169 167 mkdir("all"); 170 168 mkdir("images"); -
trunk/lib/Commitment.cc
r439 r452 23 23 24 24 #include "Commitment.h" 25 #include "Date.h"26 25 27 26 #include <string> … … 36 35 37 36 38 Commitment::Commitment(std::string author, const Date&date,37 Commitment::Commitment(std::string author, std::string date, 39 38 std::string msg, size_t rev) 40 39 : author_(author), date_(date), msg_(msg), rev_(rev) -
trunk/lib/Commitment.h
r439 r452 25 25 */ 26 26 27 #include "Date.h"28 29 27 #include <string> 30 28 … … 49 47 \brief The contructor. 50 48 */ 51 Commitment(std::string author, const Date&date, std::string msg,49 Commitment(std::string author, std::string date, std::string msg, 52 50 size_t rev); 53 51 … … 60 58 \return Date 61 59 */ 62 inline const Date&date(void) const { return date_; }60 inline std::string date(void) const { return date_; } 63 61 64 62 /** … … 80 78 81 79 std::string author_; 82 Datedate_;80 std::string date_; 83 81 std::string msg_; 84 82 size_t rev_; -
trunk/lib/Directory.cc
r447 r452 110 110 111 111 112 SVNlog Directory::log(void) const 113 { 114 // not yet implemented 115 assert(0); 112 SVNlog Directory::log_core(void) const 113 { 114 SVNlog log(path()); 115 for (NodeConstIterator i(daughters_.begin()); i != daughters_.end(); ++i) 116 log += (*i)->log(); 117 return log; 116 118 } 117 119 -
trunk/lib/Directory.h
r447 r452 72 72 73 73 /** 74 @return union of logs from daughter nodes.75 */76 SVNlog log(void) const;77 78 /**79 74 @return The explicit string "directory", nothing else. 80 75 */ … … 91 86 92 87 private: 88 /** 89 @return union of logs from daughter nodes. 90 */ 91 SVNlog log_core(void) const; 92 93 93 /// 94 94 /// @brief Copy Constructor, not implemented -
trunk/lib/File.cc
r447 r452 170 170 171 171 172 SVNlog File::log (void) const172 SVNlog File::log_core(void) const 173 173 { 174 174 return SVNlog(path()); -
trunk/lib/File.h
r447 r452 50 50 51 51 /** 52 @return log of this File.53 */54 SVNlog log(void) const;55 56 /**57 52 @return The explicit string "file", nothing else. 58 53 */ … … 74 69 75 70 private: 71 /** 72 @return log of this File. 73 */ 74 SVNlog log_core(void) const; 75 76 76 /// 77 77 /// @brief Copy Constructor, not implemented -
trunk/lib/LogIterator.cc
r450 r452 28 28 #include <cassert> 29 29 30 #include <iostream> 30 31 namespace theplu{ 31 32 namespace svndigest{ 32 33 33 34 LogIterator::LogIterator(const SVNlog& log, size_t index) 34 : log_(log), index_(index) 35 {} 35 : commit_(NULL), log_(log), index_(index) 36 { 37 update_commit(); 38 } 39 40 41 LogIterator::LogIterator(const LogIterator& other) 42 : commit_(NULL), log_(other.log_), index_(other.index_) 43 { 44 update_commit(); 45 } 36 46 37 47 … … 43 53 44 54 55 void LogIterator::update_commit(void) 56 { 57 if (commit_) 58 delete commit_; 59 if (index_<log_.author().size()) 60 commit_ = new Commitment(log_.author()[index_], 61 log_.date()[index_], 62 log_.message()[index_], 63 log_.revision()[index_]); 64 else 65 commit_ = NULL; 66 } 67 68 45 69 bool LogIterator::operator<(const LogIterator& other) const 46 70 { 71 assert(&log_==&other.log_); 47 72 return index_<other.index_; 48 73 } 49 74 50 75 51 const Commitment& LogIterator::operator*() 76 const Commitment& LogIterator::operator*() const 52 77 { 53 78 assert(index_<log_.revision().size()); 54 if (!commit_) 55 commit_ = new Commitment(log_.author()[index_],56 log_.date()[index_],57 log_.message()[index_],58 log_.revision()[index_]);79 if (!commit_){ 80 std::cout << index_ << std::endl; 81 82 } 83 assert(commit_); 59 84 return *commit_; 60 85 } 61 86 62 87 63 const Commitment* LogIterator::operator->(void) 88 const Commitment* LogIterator::operator->(void) const 64 89 { 65 90 return &this->operator*(); … … 69 94 LogIterator& LogIterator::operator++(void) 70 95 { 71 if (index_<log_.revision().size()){ 72 ++index_; 73 delete commit_; 74 commit_ = NULL; 75 } 96 ++index_; 97 if (index_>log_.revision().size()) 98 index_=log_.revision().size(); 99 update_commit(); 76 100 77 101 return *this; -
trunk/lib/LogIterator.h
r448 r452 41 41 LogIterator(const SVNlog&, size_t index=0); 42 42 43 /** 44 Copy Constructor 45 */ 46 LogIterator(const LogIterator&); 47 43 48 virtual ~LogIterator(); 44 49 45 50 bool operator<(const LogIterator&) const; 46 const Commitment* operator->() ;47 const Commitment& operator*() ;51 const Commitment* operator->() const; 52 const Commitment& operator*() const; 48 53 LogIterator& operator++(); 49 54 50 55 private: 51 // Copy Constructor not implemented52 LogIterator(const LogIterator&);53 56 // Assignment operator not implemented 54 57 LogIterator& operator=(const LogIterator&); 58 59 void update_commit(void); 55 60 56 61 Commitment* commit_; -
trunk/lib/Node.cc
r439 r452 23 23 24 24 #include "Node.h" 25 26 #include "Date.h" 25 27 #include "html_utility.h" 26 28 #include "SVNlog.h" … … 60 62 lstat(path.c_str(),&nodestat); // C api from sys/stat.h 61 63 link_ = S_ISLNK(nodestat.st_mode); 64 } 65 66 67 std::string Node::author(void) const 68 { 69 if (ignore()) 70 return svninfo_.last_changed_author(); 71 assert(log().author().size()); 72 return log().author().back(); 62 73 } 63 74 … … 112 123 113 124 } 114 os << "<td>" << trac_revision(stats_.last_changed_rev()) << "</td>\n" 125 126 os << "<td>" << trac_revision(last_changed_rev()) << "</td>\n" 115 127 << "<td>" << author() << "</td>\n" 116 128 << "</tr>\n"; 129 } 130 131 132 svn_revnum_t Node::last_changed_rev(void) const 133 { 134 if (ignore()) 135 return svninfo_.last_changed_rev(); 136 assert(log().revision().size()); 137 return log().revision().back(); 138 } 139 140 141 SVNlog Node::log(void) const 142 { 143 if (ignore()) 144 return SVNlog(); 145 return log_core(); 117 146 } 118 147 … … 216 245 Commitment lc(log.latest_commit(*i)); 217 246 os << "</td>" << "<td>" << trac_revision(lc.revision()) 218 << "</td>" << "<td>" << lc.date()(timefmt);247 << "</td>" << "<td>" << Date(lc.date())(timefmt); 219 248 } 220 249 else { … … 244 273 Commitment lc(log.latest_commit()); 245 274 os << "<td>" << trac_revision(lc.revision()) << "</td>\n"; 246 os << "<td>" << lc.date()(timefmt)<< "</td>\n";275 os << "<td>" << Date(lc.date())(timefmt)<< "</td>\n"; 247 276 os << "</tr>\n"; 248 277 os << "</tbody>\n"; -
trunk/lib/Node.h
r447 r452 68 68 /// @brief Get the author of the latest commit. 69 69 /// 70 inline const std::string& author(void) const71 { return svninfo_.last_changed_author(); } 70 std::string author(void) const; 71 72 72 73 73 /** … … 110 110 /// @brief Get the revision number of the latest commit. 111 111 /// 112 inline svn_revnum_t last_changed_rev(void) const 113 { return svninfo_.last_changed_rev(); } 112 svn_revnum_t last_changed_rev(void) const; 114 113 115 114 /** 116 115 @return log of this node in a recursive manner. 117 116 */ 118 virtual SVNlog log(void) const=0;117 SVNlog log(void) const; 119 118 120 119 /** … … 186 185 187 186 protected: 187 188 virtual SVNlog log_core(void) const=0; 188 189 189 190 /// -
trunk/lib/SVNlog.cc
r448 r452 25 25 26 26 #include "Commitment.h" 27 #include "LogIterator.h" 27 28 #include "SVN.h" 28 29 30 #include <algorithm> 29 31 #include <cassert> 30 32 #include <string> … … 37 39 SVNlog::SVNlog(void) 38 40 { 39 assert(date().size()==author().size()); 40 assert(date().size()==revision().size()); 41 assert(date().size()==message().size()); 41 assert(date().empty()); 42 assert(author().empty()); 43 assert(revision().empty()); 44 assert(message().empty()); 42 45 } 43 46 … … 58 61 59 62 63 LogIterator SVNlog::begin() const 64 { 65 return LogIterator(*this, 0); 66 } 67 68 69 LogIterator SVNlog::end() const 70 { 71 return LogIterator(*this, revision().size()); 72 } 73 74 60 75 bool SVNlog::exist(std::string name) const 61 76 { … … 68 83 Commitment SVNlog::latest_commit(void) const 69 84 { 70 return Commitment(author().back(), Date(date().back()),85 return Commitment(author().back(), date().back(), 71 86 message().back(), revision().back()); 72 87 … … 84 99 return c; 85 100 } 86 return Commitment(author()[dist-1], Date(date()[dist-1]),101 return Commitment(author()[dist-1], date()[dist-1], 87 102 message()[dist-1], revision()[dist-1]); 88 103 104 } 105 106 107 void SVNlog::push_back(const Commitment& c) 108 { 109 lb_.authors.push_back(c.author()); 110 lb_.commit_dates.push_back(c.date()); 111 lb_.msg.push_back(c.message()); 112 lb_.rev.push_back(c.revision()); 113 } 114 115 116 void SVNlog::reserve(size_t i) 117 { 118 lb_.authors.reserve(i); 119 lb_.commit_dates.reserve(i); 120 lb_.msg.reserve(i); 121 lb_.rev.reserve(i); 89 122 } 90 123 … … 114 147 115 148 149 void SVNlog::swap(SVNlog& rhs) 150 { 151 lb_.authors.swap(rhs.lb_.authors); 152 lb_.commit_dates.swap(rhs.lb_.commit_dates); 153 lb_.msg.swap(rhs.lb_.msg); 154 lb_.rev.swap(rhs.lb_.rev); 155 } 156 157 158 SVNlog& operator+=(SVNlog& lhs, const SVNlog& rhs) 159 { 160 SVNlog log; 161 LogIterator lhs_iter(lhs.begin()); 162 LogIterator rhs_iter(rhs.begin()); 163 while(lhs_iter<lhs.end() && rhs_iter<rhs.end()) { 164 if (lhs_iter->revision() < rhs_iter->revision()) { 165 166 log.push_back(*lhs_iter); 167 ++lhs_iter; 168 } 169 else if (rhs_iter->revision()<lhs_iter->revision()) { 170 log.push_back(*rhs_iter); 171 ++rhs_iter; 172 } 173 else { 174 log.push_back(*lhs_iter); 175 ++lhs_iter; 176 ++rhs_iter; 177 } 178 } 179 while(lhs_iter<lhs.end()) { 180 log.push_back(*lhs_iter); 181 ++lhs_iter; 182 } 183 while(rhs_iter<rhs.end()) { 184 log.push_back(*rhs_iter); 185 ++rhs_iter; 186 } 187 lhs.swap(log); 188 return lhs; 189 } 190 116 191 }} // end of namespace svndigest and namespace theplu -
trunk/lib/SVNlog.h
r448 r452 28 28 29 29 #include "Commitment.h" 30 #include "LogIterator.h" 30 31 31 32 #include <string> … … 72 73 73 74 /** 75 */ 76 LogIterator begin(void) const; 77 78 /** 74 79 \return Dates 75 80 */ 76 81 inline const std::vector<std::string>& date(void) const 77 82 { return lb_.commit_dates; } 83 84 /** 85 */ 86 LogIterator end(void) const; 78 87 79 88 /** … … 105 114 { return lb_.rev; } 106 115 116 /** 117 */ 118 void push_back(const Commitment&); 119 120 /** 121 */ 122 void reserve(size_t i); 123 124 /** 125 */ 126 void swap(SVNlog&); 127 107 128 private: 108 129 … … 148 169 /** 149 170 */ 150 //SVNlog& operator+=(SVNlog&, const SVNlog&);171 SVNlog& operator+=(SVNlog&, const SVNlog&); 151 172 152 173 }} // end of namespace svndigest and namespace theplu -
trunk/lib/first_page.cc
r439 r452 77 77 print_footer(os); 78 78 os.close(); 79 80 79 } 81 80 … … 83 82 size_t nof_authors, std::string url) 84 83 { 84 assert(log.date().size()); 85 85 Date begin(log.date()[0]); 86 86 Date end(log.date().back()); … … 144 144 << "<td>" << stats.comments(i->author()) << " (" 145 145 << 100*stats.comments(i->author())/stats.comments() << "%)</td>" 146 << "<td>" << i->date()(timefmt) << "</td>"146 << "<td>" << Date(i->date())(timefmt) << "</td>" 147 147 <<"</tr>"; 148 148 }
Note: See TracChangeset
for help on using the changeset viewer.