Changeset 380


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

Addresses #62. First blame output with lines.

Location:
trunk/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r378 r380  
    22
    33/*
    4   Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    65
    76  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
  • trunk/lib/Directory.h

    r343 r380  
    7272    std::string href(void) const;
    7373
    74     ///
    75     /// @return directory
    76     ///
     74    /**
     75       @return The explicit string "directory", nothing else.
     76    */
    7777    std::string node_type(void) const;
    7878
  • 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);
  • trunk/lib/File.h

    r356 r380  
    55
    66/*
    7   Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    98
    109  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
     
    5049    std::string href(void) const;
    5150
    52     ///
    53     /// @return file
    54     ///
     51    /**
     52       @return The explicit string "file", nothing else.
     53    */
    5554    std::string node_type(void) const;
    5655
     
    6665    ///
    6766    const Stats& parse(const bool verbose=false);
    68 
    69     ///
    70     /// print blame output
    71     ///
    72     void print_blame(std::ofstream&, const std::string line_type) const;
    7367
    7468    void print_copyright(std::map<std::string, Alias>&) const;
     
    8882    File(const File&);
    8983
     84    /**
     85       @brief Print blame output
     86    */
     87    void print_blame(std::ofstream&) const;
     88
    9089    void print_core(bool verbose=false) const;
    9190
  • trunk/lib/HtmlStream.cc

    r286 r380  
    22
    33/*
    4   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    55
    66  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
     
    3838    map_['>']=std::string("&gt;");
    3939    map_['&']=std::string("&amp;");
     40    map_[' ']=std::string("&nbsp;");
    4041    // This should be configurable, but for now indentation is two spaces.
    4142    map_['\t']=std::string("&nbsp;&nbsp;");
  • trunk/lib/Node.h

    r361 r380  
    55
    66/*
    7   Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    98
    109  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
     
    114113    { return svninfo_.last_changed_rev(); }
    115114
    116     ///
    117     /// @return file or directory
    118     ///
     115    /**
     116       @return The explicit string identifying the underlying derived
     117       class.
     118    */
    119119    virtual std::string node_type(void) const=0;
    120120
  • trunk/lib/SVNblame.h

    r205 r380  
    55
    66/*
    7   Copyright (C) 2006 Jari Häkkinen
     7  Copyright (C) 2006, 2007 Jari Häkkinen
    88
    99  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
     
    8484       item. The pointer is only valid while the SVNblame object is in
    8585       scope.
    86    
     86
     87       @return Pointer to a blame_information struct if more lines are
     88       available NULL otherwise.
     89
    8790       @see struct blame_information.
    8891    */
  • trunk/lib/css.cc

    r379 r380  
    147147    s << "table.main td {\n";
    148148    s << " padding: 0 1em .1em 0;\n";
    149     s << "}\n";
     149    s << "}\n\n";
    150150
    151151    s << "table.blame {\n";
     
    157157    s << " width: 100%;\n";
    158158    s << "}\n";
    159     s << "\n";
    160159    s << "table.blame th {\n";
    161160    s << " text-align: left;\n";
     
    163162    s << " font-size: 12px\n";
    164163    s << "}\n";
     164    s << "table.blame th.author { width: 8em; text-align:right }\n";
     165    s << "table.blame th.date { width: 8em; text-align:center }\n";
     166    s << "table.blame th.number { width: 2em }\n";
    165167    s << "table.blame thead { background: #f7f7f0 }\n";
    166168    s << "table.blame thead th {\n";
     
    172174    s << " vertical-align: bottom;\n";
    173175    s << "}\n";
    174     s << "\n";
    175     s << "table.blame tbody td a:hover, table.listing tbody th a:hover {\n";
    176     s << " background-color: transparent;\n";
    177     s << "}\n";
    178     s << "\n";
    179     s << "table.blame tbody td, table.listing tbody th {\n";
     176    s << "table.blame tbody td a:hover, table.blame tbody th a:hover {\n";
     177    s << " background-color: transparent;\n";
     178    s << "}\n";
     179    s << "table.blame tbody td, table.blame tbody th {\n";
    180180    s << " border: 1px dotted #ddd;\n";
    181181    s << " padding: .33em .5em;\n";
    182     s << " vertical-align: top;\n";
    183     s << "}\n";
    184     s << "\n";
    185     s << "table.blame tbody td a:hover, table.listing tbody th a:hover {\n";
     182    s << " vertical-align: bottom;\n";
     183    s << "}\n";
     184    s << "table.blame tbody td a:hover, table.blame tbody th a:hover {\n";
    186185    s << " background-color: transparent;\n";
    187186    s << "}\n";
     
    191190    s << "table.blame tbody tr:hover { background: #eed }\n";
    192191    s << "table.blame tbody td { text-align: left }\n";
     192    s << "table.blame tbody td.author { text-align: right }\n";
     193    s << "table.blame tbody td.code { font: normal 12px monospace }\n";
     194    s << "table.blame tbody td.date { text-align: center }\n";
     195    s << "table.blame tbody td.number { text-align: right }\n";
    193196    s << "table.blame tbody td a { display: block; }\n";
    194197    s << "table.blame tbody td.directory a { font-weight: bold }\n";
Note: See TracChangeset for help on using the changeset viewer.