Ignore:
Timestamp:
Oct 23, 2010, 6:41:33 PM (11 years ago)
Author:
Peter Johansson
Message:

refs #476. Merged visitor branch into trunk. Used 'svn merge /branches/visitor' because --reintegrate did (currently) not work on our repo. Since I could not merge as suggested in subversion manual, I reverted all mergeinfo properties to avoid future confusion by svn-client. This means (I think) that there will be no connection about this commit and the visitor branch, but to svn-client this will look like a large changeset (just like a merge in the old days).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/main_utility.cc

    r1102 r1234  
    2323
    2424#include "Configuration.h"
     25#include "CopyrightVisitor.h"
    2526#include "Node.h"
    2627#include "utility.h"
     
    5859
    5960
    60   void update_copyright(const Node& tree, bool verbose)
     61  void update_copyright(Node& tree, bool verbose, bool ignore_cache)
    6162  {
    6263    if (verbose)
     
    6465    const Configuration& config = Configuration::instance();
    6566    std::map<std::string, Alias> alias(config.copyright_alias());
    66     tree.print_copyright(alias, verbose);
     67
     68    // map with last rev for every year
     69    std::map<int, svn_revnum_t> year2rev;
     70    // get log for entire project
     71    SVNlog log(SVNinfo(tree.path()).repos_root_url());
     72    typedef SVNlog::container::const_iterator LogIterator;
     73    for (LogIterator i=log.commits().begin(); i!=log.commits().end(); ++i){
     74      time_t sec = str2time(i->date());
     75      tm* timeinfo = gmtime(&sec);
     76      // ignore commits in repository not present in wc
     77      year2rev[timeinfo->tm_year] = std::min(i->revision(),
     78                                             tree.last_changed_rev());
     79    }
     80
     81    CopyrightVisitor visitor(alias, verbose, year2rev, ignore_cache);
     82    tree.traverse(visitor);
    6783  }
    6884
Note: See TracChangeset for help on using the changeset viewer.