Changeset 497


Ignore:
Timestamp:
Oct 14, 2007, 6:58:06 AM (14 years ago)
Author:
Peter Johansson
Message:

preparing for more statistics by adding StatsType layer in structure on top of previous structure, i.e., NewStructure? = StatsType/OldStructure?

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/svndigest.cc

    r487 r497  
    4545#include <unistd.h>
    4646
     47void create_file_struct(std::string stats_type,
     48                        const theplu::svndigest::Stats& stats);
     49
    4750int main(const int argc,const char* argv[])
    4851{
     
    165168    print_css("svndigest.css");
    166169    print_main_page(tree->name(), tree->log(), stats, tree->url());
    167     mkdir("all");
    168     mkdir("images");
    169     touch("all/index.html");
    170     touch("images/index.html");
    171     for (std::set<std::string>::const_iterator i = stats.authors().begin();
    172          i!=stats.authors().end(); ++i) {
    173       mkdir(*i);
    174       touch(std::string(*i+"/index.html"));
    175     }
     170    // create structure StatsType/Author/LineType
     171    create_file_struct("classic/", stats);
    176172    try {
    177173      tree->print(option->verbose());
     
    205201  exit(0);        // normal exit
    206202}
     203
     204  void create_file_struct(std::string stats_type,
     205                          const theplu::svndigest::Stats& stats)
     206  {
     207    using namespace theplu::svndigest;
     208    mkdir(stats_type);
     209    touch(stats_type+std::string("index.html"));
     210    mkdir(stats_type+std::string("all"));
     211    mkdir(stats_type+std::string("images"));
     212    touch(stats_type+std::string("all/index.html"));
     213    touch(stats_type+std::string("images/index.html"));
     214    for (std::set<std::string>::const_iterator i = stats.authors().begin();
     215         i!=stats.authors().end(); ++i) {
     216      mkdir(stats_type+*i);
     217      touch(stats_type+*i+std::string("/index.html"));
     218    }
     219  }
  • trunk/lib/Directory.cc

    r487 r497  
    148148
    149149
    150   void Directory::print_core(const std::string& user,
     150  void Directory::print_core(const std::string& stats_type,
     151                             const std::string& user,
    151152                             const std::string& line_type,
    152153                             const SVNlog& log) const
    153154  {
    154155
    155     std::string outdir = user+"/"+line_type+"/"+local_path_;
     156    std::string outdir = stats_type+"/"+user+"/"+line_type+"/"+local_path_;
    156157    if (local_path_=="")
    157       outdir = user+"/"+line_type;
     158      outdir = stats_type+"/"+user+"/"+line_type;
    158159
    159160    mkdir(outdir);
    160     std::string imagedir = "images/"+line_type+"/"+local_path_;
     161    std::string imagedir = stats_type+"/"+"images/"+line_type+"/"+local_path_;
    161162    if (user=="all")
    162163      mkdir(imagedir);
     
    165166    assert(os.good());
    166167    if (local_path().empty())
    167       print_header(os, name(), level_+2, user, line_type, "index.html");
     168      print_header(os, name(), level_+3, user, line_type, "index.html");
    168169    else
    169       print_header(os, name(), level_+2, user, line_type,
     170      print_header(os, name(), level_+3, user, line_type,
    170171                   local_path()+"/index.html");
    171172    path_anchor(os);
     
    173174    for (size_t i=0; i<level_; ++i)
    174175      os << "../";
    175     os << "../../";
     176    os << "../../../";
    176177    if (user=="all")
    177178      os << stats_.plot(imagedir+"/index.png", line_type);
  • trunk/lib/Directory.h

    r487 r497  
    9898    void print_core(bool verbose=false) const;
    9999
    100     void print_core(const std::string& user, const std::string& line_type,
    101                     const SVNlog&) const;
     100    void print_core(const std::string& stats_type, const std::string& user,
     101                    const std::string& line_type, const SVNlog&) const;
    102102
    103103
  • trunk/lib/File.cc

    r487 r497  
    309309
    310310
    311   void File::print_core(const std::string& user, const std::string& line_type,
     311  void File::print_core(const std::string& stats_type,
     312                        const std::string& user, const std::string& line_type,
    312313                        const SVNlog& log) const
    313314  {
    314     std::string outpath = user+"/"+line_type+"/"+local_path();
    315     std::string imagefile = "images/"+line_type+"/"+local_path_+".png";
     315    std::string outpath = stats_type+"/"+user+"/"+line_type+"/"+local_path();
     316    std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+
     317      local_path_+".png";
    316318    std::string html_name(outpath + ".html");
    317319    std::ofstream os(html_name.c_str());
    318     print_header(os, name(), level_+2, user, line_type, local_path()+".html");
     320    print_header(os, name(), level_+3, user, line_type, local_path()+".html");
    319321    path_anchor(os);
    320322
     
    322324    for (size_t i=0; i<level_; ++i)
    323325      os << "../";
    324     os << "../../";
     326    os << "../../../";
    325327    if (user=="all")
    326328      os << stats_.plot(imagefile,line_type);
  • trunk/lib/File.h

    r487 r497  
    121121    /// (or total).
    122122    ///
    123     void print_core(const std::string& user, const std::string& line_type,
    124                     const SVNlog&) const;
     123    void print_core(const std::string& stats_type, const std::string& user,
     124                    const std::string& line_type, const SVNlog&) const;
    125125
    126126    /**
  • trunk/lib/Node.cc

    r482 r497  
    202202      std::cout << "Printing output for " << path_ << std::endl;
    203203    SVNlog log(path_);
    204     print_core("all", "total", log);
    205     print_core("all", "code", log);
    206     print_core("all", "comments", log);
    207     print_core("all", "empty", log);
     204    print_core("classic", "all", "total", log);
     205    print_core("classic", "all", "code", log);
     206    print_core("classic", "all", "comments", log);
     207    print_core("classic", "all", "empty", log);
    208208
    209209    for (std::set<std::string>::const_iterator i = stats_.authors().begin();
    210210         i!=stats_.authors().end(); ++i) {
    211       print_core(*i, "total", log);
    212       print_core(*i, "code", log);
    213       print_core(*i, "comments", log);
    214       print_core(*i, "empty", log);
     211      print_core("classic", *i, "total", log);
     212      print_core("classic", *i, "code", log);
     213      print_core("classic", *i, "comments", log);
     214      print_core("classic", *i, "empty", log);
    215215    }
    216216   
  • trunk/lib/Node.h

    r487 r497  
    212212    /// (or total).
    213213    ///
    214     virtual void print_core(const std::string& user,
     214    virtual void print_core(const std::string& stats_type,
     215                            const std::string& user,
    215216                            const std::string& line_type,
    216217                            const SVNlog&) const=0;
  • trunk/lib/first_page.cc

    r492 r497  
    137137        os << i->author();
    138138      else
    139         os << anchor(string(i->author()+"/total/index.html"),i->author());
     139        os << anchor(std::string("classic/"+i->author()+"/total/index.html"),
     140                     i->author());
    140141      os << "</td><td>" << stats.lines(i->author()) << " ("
    141142         << 100*stats.lines(i->author())/(stats.lines()?stats.lines():1)
     
    177178    const Configuration& conf = Configuration::instance();
    178179    for (size_t i=0; i<10 && a!=log.author().rend(); ++i) {
    179       os << "<tr><td>" << anchor(*a+"/total/index.html",*a) << "</td>";
     180      os << "<tr><td>"
     181         << anchor(std::string("classic/")+*a+"/total/index.html",*a)
     182         << "</td>";
    180183      Date date(*d);
    181184      os << "<td>" << date(timefmt) << "</td>";
  • trunk/lib/html_utility.cc

    r462 r497  
    9696    else
    9797      os << "<li>";
    98     os << anchor(user+"/total/"+path, "Total", level,
     98    os << anchor("classic/"+user+"/total/"+path, "Total", level,
    9999           "View statistics of all lines");
    100100    os << "</li>";
     
    104104    else
    105105      os << "<li>";
    106     os << anchor(user+"/code/"+path, "Code", level,
     106    os << anchor("classic/"+user+"/code/"+path, "Code", level,
    107107                 "View statistics of code lines");
    108108    os << "</li>";
     
    112112    else
    113113      os << "<li>";
    114     os << anchor(user+"/comments/"+path, "Comment", level,
     114    os << anchor("classic/"+user+"/comments/"+path, "Comment", level,
    115115                 "View statistics of comment lines");
    116116    os << "</li>";
     
    121121    else
    122122      os << "<li>";
    123     os << anchor(user+"/empty/"+path, "Other", level,
     123    os << anchor("classic/"+user+"/empty/"+path, "Other", level,
    124124                 "View statistics of other lines");
    125125    os << "</li>"
Note: See TracChangeset for help on using the changeset viewer.