Changeset 380 for trunk/lib/File.cc


Ignore:
Timestamp:
Jun 21, 2007, 9:25:39 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Addresses #62. First blame output with lines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r379 r380  
    2525
    2626#include "Alias.h"
     27#include "Date.h"
    2728#include "html_utility.h"
     29#include "HtmlStream.h"
    2830#include "Stats.h"
     31#include "SVNblame.h"
    2932#include "SVNlog.h"
    3033
     
    7780  }
    7881
    79   /*
    80   void File::blame_anchor(std::ostream& os) const
    81   {
    82     os << "<h2 class=\"path\">\n";
    83     std::vector<std::string> words;
    84     words.reserve(level_+1);
    85     std::string word;
    86     words.push_back(Node::project_);
    87     std::stringstream ss(local_path());
    88     while(getline(ss,word,'/'))
    89       if (!word.empty()) // ignore double slash in path
    90         words.push_back(word);
    91     if (words.size()==1)
    92       os << anchor("index.html", Node::project_,0, "View " + Node::project_);
    93     else {
    94       for (size_t i=0; i<words.size()-1; ++i){
    95         os << anchor("index.html", words[i], level_-i, "View " + words[i]);
    96         os << "<span class=\"sep\">/</span>\n";
    97       }
    98       os << anchor(href(), words.back(), level_+2-words.size(),
    99              "View " + words.back());
    100     }
    101     os << "\n</h2>\n";
    102   }
    103   */
    104 
    105   void File::print_blame(std::ofstream& os, const std::string line_type) const
    106   {
    107     os << "<h3>Blame information</h3>";
     82
     83  void File::print_blame(std::ofstream& os) const
     84  {
     85    os << "<br><h3>Blame Information</h3>";
    10886    os << "<table class=\"blame\">\n";
    10987    os << "<thead>\n";
    11088    os << "<tr>\n";
    111     os << "<th>Rev</th>\n";
    112     os << "<th>Author</th>\n";
     89    os << "<th class=\"number\">Rev</th>\n";
     90    os << "<th class=\"date\">Date</th>\n";
     91    os << "<th class=\"author\">Author</th>\n";
     92    os << "<th class=\"number\">Lineno</th>\n";
    11393    os << "<th>Line</th>\n";
    11494    os << "</tr>\n</thead>\n";
    11595    os << "<tbody>\n";
    116 
     96    HtmlStream hs(os);
     97    SVNblame blame(path_);
     98    while (const struct SVNblame::blame_information* bi=blame.next()) {
     99      os << "<tr>\n<td class=\"number\">" << bi->revision
     100         << "</td>\n<td class=\"date\">"  << Date(bi->date)("%e %b %y")
     101         << "</td>\n<td class=\"author\">";
     102      hs << bi->author;
     103      os << "</td>\n<td class=\"number\">" << bi->line_no+1
     104         << "</td>\n<td class=\"code\">";
     105      hs << bi->line;
     106      os << "</td>\n</tr>\n";
     107    }
    117108    os << "</tbody>\n";
    118109    os << "</table>\n";
     
    259250    os << "</p>\n";
    260251
    261     print_blame(os,line_type);
     252    print_blame(os);
    262253
    263254    print_footer(os);
Note: See TracChangeset for help on using the changeset viewer.