Changeset 1453 for trunk


Ignore:
Timestamp:
Dec 23, 2011, 5:00:22 AM (9 years ago)
Author:
Peter Johansson
Message:

refs #387. implement core of svncopyright:ignore

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/CopyrightStats.cc

    r1451 r1453  
    3636#include <fstream>
    3737#include <iostream>
     38#include <sstream>
    3839
    3940namespace theplu {
     
    4546                                 const std::map<int, svn_revnum_t>& year2rev,
    4647                                 const SegmentSet<svn_revnum_t>& ignore_revs)
    47     : path_(path)
     48    : ignore_revs_(ignore_revs), path_(path)
    4849  {
    4950    cache_file_ = concatenate_path(concatenate_path(directory_name(path),
    5051                                                    ".svndigest"),
    5152                                   file_name(path)+".svncopyright-cache");
    52     config_ = Configuration::instance().code(path_);
     53    std::ostringstream ss;
     54    ss << Configuration::instance().code(path_);
     55    for (SegmentSet<svn_revnum_t>::const_iterator i=ignore_revs.begin();
     56         i!=ignore_revs.end(); ++i) {
     57      ss << i->begin() << "-" << i->end() << ";";
     58    }
     59    config_ = ss.str();
    5360    init(ignore_cache, year2rev);
    5461  }
     
    139146    // loop over all commits
    140147    for ( ; commit!=end; ++commit) {
     148      // skip commit if its revision is in revisions to ignore
     149      if (ignore_revs_.count(commit->revision()))
     150        continue;
    141151      // assure yearrev correspond to commit
    142152      while (yearrev->second < commit->revision()) {
  • trunk/lib/CopyrightStats.h

    r1451 r1453  
    6565    std::string cache_file_;
    6666    std::string config_;
     67    const yat::utility::SegmentSet<svn_revnum_t>& ignore_revs_;
    6768    std::string path_;
    6869    std::map<int, std::set<std::string> > year2user_;
  • trunk/lib/SVNproperty.cc

    r1438 r1453  
    9090      std::string second;
    9191      bool found_dash = getline(ss2, second);
     92      trim(second);
    9293      yat::utility::Segment<svn_revnum_t> rev_interval;
    9394      using yat::utility::convert;
     
    104105          rev_interval.end() = std::numeric_limits<svn_revnum_t>::max();
    105106        else
    106           rev_interval.end() = convert<svn_revnum_t>(first)+1;
     107          rev_interval.end() = convert<svn_revnum_t>(second)+1;
    107108      }
    108109      svncopyright_ignore_rev_.insert_merge(rev_interval);
  • trunk/test/ignore_revs_test.sh

    r1448 r1453  
    3535cat config
    3636# do not use --ignore-cache so we also test that cache is ignored automatically
    37 SVNCOPYRIGHT_run 0 --root toy_project --config-file=config
     37SVNCOPYRIGHT_run 0 --verbose --root toy_project --config-file=config
    3838}
    3939
    4040# no ignore
    41 SVNCOPYRIGHT_run 0 --ignore-cache --root toy_project
     41SVNCOPYRIGHT_run 0 -v --ignore-cache --root toy_project
    4242$GREP "2006 Jari" toy_project/README || exit_fail
    4343$GREP "2007, 2008 Peter" toy_project/README || exit_fail
     
    6767$GREP "Copyright (C) 2007, 2008 Peter" toy_project/README && exit_fail
    6868
     69$SVN revert toy_project -R
    6970# test that nonsense argument fails with grace
    7071cat > config << _EOF
     
    7475cat config
    7576# do not use --ignore-cache so we also test that cache is ignored automatically
    76 SVNCOPYRIGHT_run 1 --root toy_project --config-file=config
    77 grep svncopyright: stderr
     77SVNCOPYRIGHT_run 1 -v --root toy_project --config-file=config
     78$GREP svncopyright: stderr || exit_fail
     79$GREP yat stderr && exit_fail
     80
    7881
    7982exit_success
Note: See TracChangeset for help on using the changeset viewer.