Changeset 1456


Ignore:
Timestamp:
Dec 24, 2011, 3:18:17 AM (9 years ago)
Author:
Peter Johansson
Message:

pass svncopyright:ignore values from directory to sub-nodes. refs #387

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/CopyrightStats.cc

    r1453 r1456  
    5555    for (SegmentSet<svn_revnum_t>::const_iterator i=ignore_revs.begin();
    5656         i!=ignore_revs.end(); ++i) {
    57       ss << i->begin() << "-" << i->end() << ";";
    58     }
     57      if (i->begin()+1 == i->end())
     58        ss << i->begin();
     59      else
     60        ss << i->begin() << "-" << i->end();
     61      ss << ";";
     62  }
    5963    config_ = ss.str();
    6064    init(ignore_cache, year2rev);
  • trunk/lib/CopyrightVisitor.cc

    r1451 r1456  
    4242      ignore_cache_(ignore_cache)
    4343  {}
     44
     45
     46  void CopyrightVisitor::add(RevisionSet& a, const RevisionSet& b) const
     47  {
     48    for (RevisionSet::const_iterator i=b.begin(); i!=b.end(); ++i)
     49      a.insert_merge(*i);
     50  }
    4451
    4552
     
    105112    if (dir.svncopyright_ignore())
    106113      return false;
     114
     115    RevisionSet ignore = dir.property().svncopyright_ignore_rev();
     116
     117    typedef std::map<std::string, RevisionSet> Map;
     118    Map::const_iterator mother = path2ignore_.find(directory_name(dir.path()));
     119    if (mother!=path2ignore_.end())
     120      add(ignore, mother->second);
     121
     122    if (!ignore.empty())
     123      path2ignore_[dir.path()] = ignore;
     124
    107125    return true;
    108126  }
     
    128146    if (verbose_)
    129147      std::cout << "Parsing '" << file.path() << "'\n";
    130     const yat::utility::SegmentSet<svn_revnum_t>& ignore_revs =
    131       file.property().svncopyright_ignore_rev();
     148
     149    RevisionSet ignore_revs = file.property().svncopyright_ignore_rev();
     150
     151    typedef std::map<std::string, RevisionSet> Map;
     152    Map::const_iterator mother = path2ignore_.find(directory_name(file.path()));
     153    if (mother!=path2ignore_.end())
     154      add(ignore_revs, mother->second);
     155
    132156    CopyrightStats stats(file.path(), ignore_cache_, year2rev_, ignore_revs);
    133157    const std::map<int, std::set<std::string> >& year2users = stats.map();
  • trunk/lib/CopyrightVisitor.h

    r1451 r1456  
    7171    const std::map<int, svn_revnum_t>& year2rev_;
    7272    bool ignore_cache_;
     73    typedef yat::utility::SegmentSet<svn_revnum_t> RevisionSet;
     74    std::map<std::string, RevisionSet> path2ignore_;
     75
     76    /**
     77       add set \a b to set \a a
     78    */
     79    void add(RevisionSet& a, const RevisionSet& b) const;
    7380
    7481    /**
  • trunk/test/ignore_revs_test.sh

    r1453 r1456  
    6767$GREP "Copyright (C) 2007, 2008 Peter" toy_project/README && exit_fail
    6868
     69# test that nonsense argument fails with grace
    6970$SVN revert toy_project -R
    70 # test that nonsense argument fails with grace
    7171cat > config << _EOF
    7272[svn-props]
     
    7979$GREP yat stderr && exit_fail
    8080
     81# test ignore propert on both Node and subNode
     82$SVN revert toy_project -R
     83cat > config << _EOF
     84[copyright-alias]
     85jari = Jari
     86peter = Peter
     87[svn-props]
     88README = svncopyright:ignore=0-35
     89toy_project = svncopyright:ignore=42
     90_EOF
     91cat config
     92# do not use --ignore-cache so we also test that cache is ignored automatically
     93SVNCOPYRIGHT_run 0 -v --root toy_project --config-file=config
     94$GREP "Copyright (C) 2006" toy_project/README && exit_fail
     95$GREP "Copyright (C) 2008" toy_project/README || exit_fail
    8196
    8297exit_success
Note: See TracChangeset for help on using the changeset viewer.