Changeset 381
- Timestamp:
- Jun 21, 2007, 10:43:17 PM (15 years ago)
- Location:
- trunk/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/File.cc
r380 r381 96 96 HtmlStream hs(os); 97 97 SVNblame blame(path_); 98 while ( const struct SVNblame::blame_information* bi=blame.next()) {99 os << "<tr>\n<td class=\"number\">" << b i->revision100 << "</td>\n<td class=\"date\">" << Date(b i->date)("%e %b %y")98 while (blame.valid()) { 99 os << "<tr>\n<td class=\"number\">" << blame.revision() 100 << "</td>\n<td class=\"date\">" << Date(blame.date())("%e %b %y") 101 101 << "</td>\n<td class=\"author\">"; 102 hs << b i->author;103 os << "</td>\n<td class=\"number\">" << b i->line_no+1102 hs << blame.author(); 103 os << "</td>\n<td class=\"number\">" << blame.line_no()+1 104 104 << "</td>\n<td class=\"code\">"; 105 hs << b i->line;105 hs << blame.line(); 106 106 os << "</td>\n</tr>\n"; 107 blame.next_line(); 107 108 } 108 109 os << "</tbody>\n"; -
trunk/lib/SVNblame.cc
r149 r381 2 2 3 3 /* 4 Copyright (C) 2006 Jari Häkkinen4 Copyright (C) 2006, 2007 Jari Häkkinen 5 5 6 6 This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest … … 57 57 58 58 59 const SVNblame::blame_information* SVNblame::next(void)59 std::string SVNblame::author(void) 60 60 { 61 blame_information *bi=NULL; 62 if (blame_info_iterator_!=blame_receiver_baton_.blame_info.end()) { 63 bi=*blame_info_iterator_; 64 ++blame_info_iterator_; 65 } 66 return bi; 61 return (*blame_info_iterator_)->author; 62 } 63 64 65 bool SVNblame::binary(void) 66 { 67 return binary_; 67 68 } 68 69 … … 84 85 85 86 87 std::string SVNblame::date(void) 88 { 89 return (*blame_info_iterator_)->date; 90 } 91 92 93 std::string SVNblame::line(void) 94 { 95 return (*blame_info_iterator_)->line; 96 } 97 98 99 apr_int64_t SVNblame::line_no(void) 100 { 101 return (*blame_info_iterator_)->line_no; 102 } 103 104 105 bool SVNblame::next_line(void) 106 { 107 if (valid()) 108 ++blame_info_iterator_; 109 return valid(); 110 } 111 112 113 svn_revnum_t SVNblame::revision(void) 114 { 115 return (*blame_info_iterator_)->revision; 116 } 117 118 119 bool SVNblame::valid(void) 120 { 121 return (blame_info_iterator_!=blame_receiver_baton_.blame_info.end()); 122 } 123 86 124 }} // end of namespace svndigest and namespace theplu -
trunk/lib/SVNblame.h
r380 r381 35 35 class SVN; 36 36 37 / //38 ///The SVNblame class is a utility class for taking care of 'svn39 ///blame' information. An 'svn blame' is performed on an item, the40 ///blame information for each line is traversed with41 /// SVNblame.next() calls giving access to the blame information in42 /// a blame_information struct.43 ///37 /** 38 The SVNblame class is a utility class for taking care of 'svn 39 blame' information. An 'svn blame' is performed on an item, the 40 blame information for each line is traversed with 41 SVNblame.next_line() and SVNblame.valid() calls giving access to 42 the blame information. 43 */ 44 44 class SVNblame { 45 45 public: 46 46 47 /// 48 /// @brief Information return by subversion (blame) API 49 /// 50 /// @see Subversion API for blame usage. 51 /// 47 /** 48 @brief The contructor. 49 50 The constructor performs an 'svn blame' on \a path and 51 initializes the SVNblame object for statistics traversal using 52 SVNblame::next_line() and SVNblame::valid(). 53 */ 54 explicit SVNblame(const std::string& path); 55 56 /** 57 @brief The destructor. 58 */ 59 ~SVNblame(void); 60 61 /** 62 @brief Retrieve the blame date for the current line. 63 64 If current line is outside blame entries the behaviour is 65 undefined. 66 67 @return The date. 68 */ 69 std::string author(void); 70 71 /** 72 Returns true if item is binary false otherwise 73 74 Binary files are invalid for 'svn blame'. 75 */ 76 bool binary(void); 77 78 /** 79 @brief Retrieve the blame date for the current line. 80 81 If current line is outside blame entries the behaviour is 82 undefined. 83 84 @return The date. 85 */ 86 std::string date(void); 87 88 /** 89 @brief Retrieve the content of the current line. 90 91 If current line is outside blame entries the behaviour is 92 undefined. 93 94 @return The line content. 95 */ 96 std::string line(void); 97 98 /** 99 @brief Retrieve the line number of the current line. 100 101 If current line is outside blame entries the behaviour is 102 undefined. 103 104 @return The line number. 105 */ 106 apr_int64_t line_no(void); 107 108 /** 109 @brief Skip to the next line. 110 111 @return False if no more blame information is available, true 112 otherwise. 113 */ 114 bool next_line(void); 115 116 /** 117 @brief Retrieve the blame revision of the current line. 118 119 If current line is outside blame entries the behaviour is 120 undefined. 121 122 @return The blame revision. 123 */ 124 svn_revnum_t revision(void); 125 126 /** 127 @brief Check if more blame information is available. 128 129 @return True if valid information exists, false otherwise. 130 */ 131 bool valid(void); 132 133 private: 134 135 /** 136 @brief Copy Constructor, not implemented. 137 */ 138 SVNblame(const SVNblame&); 139 140 /** 141 @brief Information return by subversion (blame) API 142 143 @see Subversion API for blame usage. 144 */ 52 145 struct blame_information { 53 146 apr_int64_t line_no; … … 57 150 std::string line; 58 151 }; 59 60 ///61 /// @brief The contructor.62 ///63 /// The constructor performs an 'svn blame' on \a path and64 /// initializes the SVNblame object for statistics traversal using65 /// SVNblame::next().66 ///67 explicit SVNblame(const std::string& path);68 69 ///70 /// @brief The destructor.71 ///72 ~SVNblame(void);73 74 ///75 /// @brief Returns true if item is binary false otherwise76 ///77 /// Binary files are invalid for 'svn blame'.78 ///79 inline bool binary(void) { return binary_; }80 81 /**82 Traverse all lines in the item for statistics analysis. There83 is currently no way to reset the pointer to the beginning of84 item. The pointer is only valid while the SVNblame object is in85 scope.86 87 @return Pointer to a blame_information struct if more lines are88 available NULL otherwise.89 90 @see struct blame_information.91 */92 const blame_information* next(void);93 94 private:95 96 ///97 /// @brief Copy Constructor, not implemented.98 ///99 SVNblame(const SVNblame&);100 152 101 153 // binary_ is true if item in any revision has been binary. -
trunk/lib/Stats.cc
r371 r381 3 3 /* 4 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006 Jari Häkkinen, Peter Johansson5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 6 6 7 7 This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest … … 148 148 149 149 SVNblame svn_blame(path); 150 while ( const SVNblame::blame_information * bi=svn_blame.next()) {151 a ssert(bi);152 add(bi->author, bi->revision, *count);150 while (svn_blame.valid()) { 151 add(svn_blame.author(), svn_blame.revision(), *count); 152 svn_blame.next_line(); 153 153 ++count; 154 154 }
Note: See TracChangeset
for help on using the changeset viewer.