Changeset 1238
- Timestamp:
- Oct 24, 2010, 12:05:25 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Directory.cc
r1236 r1238 272 272 273 273 274 void Directory::print_copyright(std::map<std::string, Alias>& alias,275 bool verbose,276 const std::map<int,svn_revnum_t>& y2r) const277 {278 if (!ignore() && !svncopyright_ignore()) {279 // print daughter nodes, i.e, this function is recursive280 for (NodeConstIterator i = daughters_.begin(); i!=daughters_.end(); ++i)281 (*i)->print_copyright(alias, verbose, y2r);282 }283 }284 285 286 274 void Directory::traverse(NodeVisitor& visitor) 287 275 { -
trunk/lib/Directory.h
r1236 r1238 94 94 std::string output_path(void) const; 95 95 96 using Node::print_copyright;97 /**98 virtual function typically called from Node::print_copyright99 */100 void print_copyright(std::map<std::string, Alias>&, bool verbose,101 const std::map<int, svn_revnum_t>&) const;102 103 96 /** 104 97 Calls visitor.enter(*this). If enter returns true, daughter -
trunk/lib/File.h
r1234 r1238 72 72 const StatsCollection& parse(bool verbose, bool ignore); 73 73 74 using Node::print_copyright;75 74 /** 76 75 @throw std::runtime_error when a file error is encountered -
trunk/lib/Node.cc
r1234 r1238 309 309 310 310 311 void Node::print_copyright(std::map<std::string,Alias>& alias,312 bool verbose) const313 {314 // map with last rev for every year315 std::map<int, svn_revnum_t> year2rev;316 // get log for entire project317 SVNlog log(SVNinfo(path()).repos_root_url());318 typedef SVNlog::container::const_iterator LogIterator;319 for (LogIterator i=log.commits().begin(); i!=log.commits().end(); ++i){320 time_t sec = str2time(i->date());321 tm* timeinfo = gmtime(&sec);322 // ignore commits in repository not present in wc323 year2rev[timeinfo->tm_year] = std::min(i->revision(), last_changed_rev());324 }325 print_copyright(alias, verbose, year2rev);326 }327 328 329 311 const StatsCollection& Node::stats(void) const 330 312 { -
trunk/lib/Node.h
r1236 r1238 171 171 const std::string& line_type, 172 172 const SVNlog&) const; 173 174 /**175 creates a map from year to last rev for that year and call176 virtual function.177 */178 void print_copyright(std::map<std::string,Alias>&, bool) const;179 180 /**181 typically called from function above182 */183 virtual void print_copyright(std::map<std::string,Alias>&, bool,184 const std::map<int,svn_revnum_t>&) const=0;185 173 186 174 /** -
trunk/test/copyright.cc
r1164 r1238 25 25 #include "lib/Configuration.h" 26 26 #include "lib/File.h" 27 #include "lib/main_utility.h" 27 28 #include "lib/SVN.h" 28 29 #include "lib/SVNinfo.h" … … 68 69 // warn about missing Copyright statement only in verbose mode 69 70 if (suite.verbose()){ 70 std::string config_str("[copyright]\nmissing-copyright-warning=yes"); 71 std::stringstream ss(config_str); 71 std::stringstream ss; 72 ss << "[copyright]\n" 73 << "missing-copyright-warning=yes\n" 74 << "[copyright-alias]\n" 75 << "jari = jh\n" 76 << "peter = pj\n"; 72 77 Configuration& config = Configuration::instance(); 73 78 config.load(ss); … … 85 90 File file(0,filename,""); 86 91 87 suite.out() << "Get stats for file" << std::endl; 88 file.parse(suite.verbose(), true); 89 90 suite.out() << "Updating copyright statements" << std::endl; 91 std::map<std::string, Alias> alias; 92 alias["jari"]=Alias("jh", 1); 93 alias["peter"]=Alias("pj", 2); 94 95 file.print_copyright(alias, suite.verbose()); 92 update_copyright(file, suite.verbose(), false); 96 93 97 94 is.open(filename.c_str());
Note: See TracChangeset
for help on using the changeset viewer.