Changeset 556 for trunk/lib


Ignore:
Timestamp:
Jan 16, 2008, 2:35:00 PM (16 years ago)
Author:
Peter Johansson
Message:

Fixing statistics bugs and links on first page

Location:
trunk/lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.cc

    r523 r556  
    263263  Configuration& Configuration::instance(void)
    264264  {
    265     if (!instance_)
     265    if (!instance_){
    266266      instance_ = new Configuration;
     267      instance_->load();
     268    }
    267269    return *instance_;
    268270  }
     
    412414      translate(word, *iter);
    413415    }
    414 
    415416  }
    416417
  • trunk/lib/Configuration.h

    r523 r556  
    5858
    5959    ///
    60     /// @brief load deafult configuration
    61     ///
    62     void load(void);
    63 
    64     ///
    6560    /// throw if stream is not a valid config
    6661    ///
     
    9186    // assignment not implemented because assignment is always self-assignment
    9287    Configuration& operator=(const Configuration&);
     88    // destructor not implemented
     89    ~Configuration(void);
    9390
    9491    friend std::ostream& operator<<(std::ostream&, const Configuration&);
     
    10097    bool equal_false(const std::string&) const;
    10198    bool equal_true(const std::string&) const;
     99    ///
     100    /// @brief load deafult configuration
     101    ///
     102    void load(void);
     103
    102104    void set_default(void);
    103105    /**
  • trunk/lib/LineTypeParser.cc

    r552 r556  
    5252        // check if line is end of copyright statement, i.e. contains
    5353        // no alphanumerical character (except in copyright_prefix).
     54        post_copyright_ = true;
    5455        for (size_t i=0; i<line.size()&&post_copyright_; ++i)
    5556          if (isalnum(line[i]) &&
  • trunk/lib/Stats.cc

    r552 r556  
    8888      std::vector<u_int>& other = other_stats()[*iter];
    8989      accumulate(other);
     90      std::vector<u_int>& copyright = copyright_stats()[*iter];
     91      accumulate(copyright);
    9092    }
    9193  }
     
    98100    add_author(user);
    99101
    100     // Peter remove repeat
     102    // FIXME: Peter, remove repeat
    101103    std::vector<u_int>& code = code_stats()[user];
    102104    if (code.size() < rev+1){
     
    134136    else if (lt == LineTypeParser::other)
    135137      other[rev]+=n;
     138
     139    std::vector<u_int>& copy = copyright_stats()[user];
     140    if (copy.size() < rev+1){
     141      copy.reserve(revision() + 1);
     142      copy.insert(copy.end(), rev - copy.size(), 0);
     143      if (lt == LineTypeParser::copyright)
     144        copy.push_back(n);
     145      else
     146        copy.push_back(0);
     147    }
     148    else if (lt == LineTypeParser::copyright)
     149      copy[rev]+=n;
    136150  }
    137151
  • trunk/lib/first_page.cc

    r546 r556  
    5151
    5252  void print_main_page(const std::string& dir, const SVNlog& log,
    53                        const Stats& stats, std::string url)
     53                       const StatsCollection& stats, std::string url)
    5454  {
    5555    std::string filename="index.html";
     
    6969      latest_commit.push_back(log.latest_commit(*i));
    7070
    71     print_summary_plot(os, stats);
     71    print_summary_plot(os, stats["classic"]);
    7272    print_general_information(os, log, authors.size(), url);
    7373    sort(latest_commit.begin(), latest_commit.end(), GreaterRevision());
    74     print_authors(os, latest_commit, stats);
    75     print_recent_logs(os, log);
     74    print_authors(os, latest_commit, stats["classic"]);
     75    print_recent_logs(os, log, stats);
    7676    os << "<hr width=100% />";
    7777    print_footer(os);
     
    130130       <<"</tr>";
    131131
    132     std::string timefmt("%b %d %H:%M:%S %Y");
     132    std::string timefmt("%Y %b %d %H:%M:%S");
    133133    using namespace std;
    134134    for (vector<Commitment>::const_iterator i=lc.begin(); i!=lc.end(); ++i) {
     
    158158
    159159
    160   void print_recent_logs(std::ostream& os, const SVNlog& log)
     160  void print_recent_logs(std::ostream& os, const SVNlog& log,
     161                         const StatsCollection& stats)
    161162  {
    162163    os << "<div class=\"main\">\n"
     
    172173    assert(log.author().size()==log.message().size());
    173174    assert(log.author().size()==log.revision().size());
    174     os << "<tr><td>Author</td><td>Date</td><td>Rev</td><td>Message</td></tr>\n";
     175    os << "<tr><td>Author</td><td>Date</td><td>Rev</td><td>Added</td>"
     176       << "<td>Removed</td><td>Message</td></tr>\n";
    175177    HtmlStream hs(os);
    176     std::string timefmt("%b %d %H:%M:%S %Y");
     178    std::string timefmt("%Y %b %d %H:%M:%S");
    177179    const size_t maxlength = 80;
    178180    const Configuration& conf = Configuration::instance();
     
    187189      os << "</td>";
    188190      os << "<td>";
     191      int added = stats["add"](LineTypeParser::total, "all", *r) -
     192        stats["add"](LineTypeParser::total, "all", *r - 1);
     193      os << added;
     194      os << "</td>";
     195      os << "<td>";
     196      os << added - (stats["blame"](LineTypeParser::total, "all", *r) -
     197                     stats["blame"](LineTypeParser::total, "all", *r - 1));
     198      os << "</td>";
     199      os << "<td>";
    189200      std::string mess = *m;
    190201      // replace newlines with space
  • trunk/lib/first_page.h

    r519 r556  
    3434  class Commitment;
    3535  class Stats;
     36  class StatsCollection;
    3637  class SVNlog;
    3738
     
    4950  /// @brief print main page
    5051  ///
    51   void print_main_page(const std::string&, const SVNlog&, const Stats&,
    52                        std::string url);
     52  void print_main_page(const std::string&, const SVNlog&,
     53                       const StatsCollection&, std::string url);
    5354   
    54   void print_recent_logs(std::ostream&, const SVNlog& log);
     55  void print_recent_logs(std::ostream&, const SVNlog& log,
     56                         const StatsCollection&);
    5557   
    5658  void print_summary_plot(std::ostream&, const Stats& stats);
  • trunk/lib/html_utility.cc

    r550 r556  
    7878                    const std::string& stats)
    7979  {
     80    os << "<!-- Generated by " << PACKAGE_STRING << "-->\n";
    8081    os << "<!DOCTYPE html\n"
    8182       << "PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
     
    146147    if (item_local=="none")
    147148      item_local = "total";
     149    if (item_local=="main")
     150      item_local = "total";
    148151
    149152    if (stats=="classic")
Note: See TracChangeset for help on using the changeset viewer.