Changeset 1362 for trunk


Ignore:
Timestamp:
Jun 4, 2011, 5:42:45 PM (10 years ago)
Author:
Peter Johansson
Message:

svncopyright: avoid parsing commit if alias already have copyright for that year.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/CopyrightStats.cc

    r1358 r1362  
    8484    while (commit->revision() < first_rev)
    8585      ++commit;
     86    assert(commit->revision() >= first_rev);
    8687    log_iterator end = log.commits().end();
    8788    // loop over all commits
     
    9293        assert(yearrev!=year2rev.end());
    9394      }
     95      assert(yearrev!=year2rev.end());
     96      assert(yearrev->second >= commit->revision());
    9497     
    95       // skip if author already has copyright for this year.
    96       std::map<int, std::set<Alias> >::const_iterator year_aliases =
    97         year2alias_.find(yearrev->first);
    98      
    99       SVNblame svn_blame(path_, commit->revision());
    100       LineTypeParser parser(path_);
    10198      const std::string& name = commit->author();
    102      
    10399      // find username in map of aliases
    104100      std::map<std::string, Alias>::iterator alias =
     
    114110        author2alias_[name] = a;
    115111        alias = author2alias_.find(name);
    116         assert(alias!=author2alias_.end());
    117112      }
     113      assert(alias!=author2alias_.end());
    118114     
     115      // skip if alias already has copyright for this year.
     116      std::map<int, std::set<Alias> >::const_iterator year_aliases =
     117        year2alias_.find(yearrev->first);
     118      if (year_aliases!=year2alias_.end()
     119          && year_aliases->second.count(alias->second))
     120        continue;
     121     
     122      SVNblame svn_blame(path_, commit->revision());
     123      LineTypeParser parser(path_);
     124
    119125      // loop over lines
    120126      while (svn_blame.valid()) {
Note: See TracChangeset for help on using the changeset viewer.