Changeset 1423
- Timestamp:
- Dec 16, 2011, 4:19:31 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/svncopyright.cc
r1264 r1423 2 2 3 3 /* 4 Copyright (C) 2010 Peter Johansson4 Copyright (C) 2010, 2011 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 22 22 #include "svncopyrightParameter.h" 23 23 24 #include "lib/CacheRemover.h" 24 25 #include "lib/Configuration.h" 25 26 #include "lib/Directory.h" … … 68 69 69 70 update_copyright(tree, option.verbose(), option.ignore_cache()); 71 CacheRemover cache_remover(option.verbose(), ".svncopyright-cache"); 72 tree.traverse(cache_remover); 70 73 } 71 74 catch (std::runtime_error& e) { -
trunk/bin/svndigest.cc
r1290 r1423 23 23 #include "svndigestParameter.h" 24 24 25 #include "lib/CacheRemover.h" 25 26 #include "lib/Configuration.h" 26 27 #include "lib/css.h" … … 133 134 tree.svn_info().url(), file_count); 134 135 136 CacheRemover cache_remover(option.verbose(), ".svndigest-cache"); 137 tree.traverse(cache_remover); 135 138 } 136 139 catch (std::runtime_error& e) { -
trunk/lib/Directory.cc
r1290 r1423 24 24 #include "Alias.h" 25 25 #include "Configuration.h" 26 #include "DirectoryUtil.h" 26 27 #include "File.h" 27 28 #include "html_utility.h" … … 39 40 #include <iostream> 40 41 #include <iterator> 41 #include <list>42 42 #include <map> 43 43 #include <sstream> 44 #include <vector> 44 45 45 #include <cerrno> // Needed to check error state below.46 #include <dirent.h>47 46 #include <sys/stat.h> 48 47 … … 51 50 52 51 53 Directory::Directory(const unsigned int level, const std::string& path, 52 Directory::Directory(const unsigned int level, const std::string& path, 54 53 const std::string& output, const std::string& project) 55 54 : Node(level,path,output,project) … … 59 58 output_dir_+='/'; 60 59 61 using namespace std; 62 DIR* directory=opendir(path.c_str()); // C API from dirent.h 63 if (!directory) 64 throw NodeException("ERROR: opendir() failed; " + path + 65 " is not a directory"); 66 list<string> entries; 67 struct dirent* entry; 68 errno=0; // Global variable used by C to track errors, from errno.h 69 while ((entry=readdir(directory))) // C API from dirent.h 70 entries.push_back(string(entry->d_name)); 71 if (errno) 72 throw NodeException("ERROR: readdir() failed on " + path); 73 closedir(directory); 60 DirectoryUtil dir(path); 74 61 75 62 SVN* svn=SVN::instance(); 76 for (list<string>::iterator i=entries.begin(); i!=entries.end(); ++i) 77 if ((*i)!=string(".") && (*i)!=string("..") && (*i)!=string(".svn")) { 78 string fullpath(path_+'/'+(*i)); 79 switch (svn->version_controlled(fullpath)) { 63 for (DirectoryUtil::const_iterator i=dir.begin(); i!=dir.end(); ++i) { 64 std::string fn = file_name(i->path()); 65 if (fn!="." && fn!=".." && fn!=".svn") { 66 const std::string& fullpath = i->path(); 67 switch(svn->version_controlled(fullpath)) { 80 68 case SVN::uptodate: 81 69 struct stat nodestat; // C api from sys/stat.h … … 91 79 } 92 80 } 81 } 93 82 std::sort(daughters_.begin(), daughters_.end(), NodePtrLess()); 94 83 } -
trunk/lib/Makefile.am
r1358 r1423 5 5 # Copyright (C) 2005 Jari Häkkinen 6 6 # Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2010 Peter Johansson7 # Copyright (C) 2010, 2011 Peter Johansson 8 8 # 9 9 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 27 27 noinst_LIBRARIES = libsvndigest.a libsvndigest_core.a 28 28 29 noinst_HEADERS = AddStats.h Alias.h BlameStats.h CacheCopyer.h ClassicStats.h \ 29 noinst_HEADERS = AddStats.h Alias.h BlameStats.h CacheCopyer.h \ 30 CacheRemover.h ClassicStats.h \ 30 31 Colors.h Commitment.h Configuration.h \ 31 32 CopyrightStats.h CopyrightVisitor.h css.h \ 32 Date.h Directory.h DirectoryPrinter.h File.h FilePrinter.h \33 Date.h Directory.h DirectoryPrinter.h DirectoryUtil.h File.h FilePrinter.h \ 33 34 first_page.h Functor.h \ 34 35 Graph.h \ … … 44 45 libsvndigest_a_SOURCES += DirectoryPrinter.cc 45 46 libsvndigest_a_SOURCES += FilePrinter.cc 46 libsvndigest_a_SOURCES += first_page.cc 47 libsvndigest_a_SOURCES += Graph.cc 47 libsvndigest_a_SOURCES += first_page.cc 48 libsvndigest_a_SOURCES += Graph.cc 48 49 libsvndigest_a_SOURCES += NodePrinter.cc 49 libsvndigest_a_SOURCES += StatsPlotter.cc 50 libsvndigest_a_SOURCES += SvndigestVisitor.cc 50 libsvndigest_a_SOURCES += StatsPlotter.cc 51 libsvndigest_a_SOURCES += SvndigestVisitor.cc 51 52 52 53 libsvndigest_core_a_SOURCES = AddStats.cc Alias.cc BlameStats.cc \ 53 CacheCopyer.cc C lassicStats.cc Colors.cc \54 CacheCopyer.cc CacheRemover.cc ClassicStats.cc Colors.cc \ 54 55 Commitment.cc Configuration.cc CopyrightStats.cc CopyrightVisitor.cc \ 55 css.cc Date.cc Directory.cc File.cc \56 css.cc Date.cc Directory.cc DirectoryUtil.cc File.cc \ 56 57 Functor.cc HtmlBuf.cc HtmlStream.cc \ 57 58 html_utility.cc LineTypeParser.cc main_utility.cc Node.cc \ … … 62 63 Trac.cc utility.cc Vector.cc 63 64 64 clean-local: 65 clean-local: 65 66 rm -rf *~ 66 67 67 68 all-local: 68 69 -
trunk/lib/SvndigestVisitor.cc
r1290 r1423 37 37 38 38 39 bool SvndigestVisitor::enter(Directory& dir) 39 bool SvndigestVisitor::enter(Directory& dir) 40 40 { 41 41 if (dir.ignore()) … … 43 43 return true; 44 44 } 45 46 45 47 void SvndigestVisitor::leave(Directory& dir) 46 47 void SvndigestVisitor::leave(Directory& dir) 48 48 { 49 49 if (report_) { … … 54 54 } 55 55 } 56 56 57 57 58 58 void SvndigestVisitor::visit(File& file) … … 70 70 71 71 }} // end of namespace svndigest and namespace theplu 72 -
trunk/lib/rmdirhier.cc
r1213 r1423 76 76 // Make sure file is removable before removing it 77 77 chmod(dir.c_str(),S_IWRITE); 78 if ( remove(dir.c_str()))78 if (::remove(dir.c_str())) 79 79 throw FileDeleteError(concatenate_path(pwd(),dir)); 80 80 return; … … 98 98 // Remove the directory from its parent 99 99 chdir(".."); 100 if ( remove(dir.c_str()))100 if (::remove(dir.c_str())) 101 101 throw DirectoryDeleteError(concatenate_path(pwd(),dir)); 102 102 } -
trunk/lib/utility.cc
r1392 r1423 28 28 29 29 #include <cassert> 30 #include <cerrno> 30 #include <cerrno> 31 31 #include <cstdio> 32 32 #include <cstdlib> … … 307 307 308 308 309 void remove(const std::string& fn) 310 { 311 if (::remove(fn.c_str())) { 312 std::string msg("remove: "); 313 msg += fn; 314 throw yat::utility::errno_error(msg); 315 } 316 } 317 318 309 319 void rename(const std::string& from, const std::string to) 310 320 { -
trunk/lib/utility.h
r1392 r1423 189 189 190 190 /** 191 same as C function remove but throws errno_error at failure 192 193 \see man remove 194 */ 195 void remove(const std::string& fn); 196 197 /** 191 198 same as rename(2) but throw errno if error is encountered 192 199 … … 269 276 270 277 }} // end of namespace svndigest end of namespace theplu 271 272 #endif 278 #endif -
trunk/test/Makefile.am
r1421 r1423 61 61 62 62 # tests not yet passing are listed here 63 XFAIL_TESTS = remove_cache_test.sh63 XFAIL_TESTS = 64 64 65 65 noinst_HEADERS = Suite.h -
trunk/test/remove_cache_test.sh
r1421 r1423 49 49 || exit_fail 50 50 test -e toy_project/empty/.svndigest && exit_fail 51 test -e toy_project/dir_to_be_ignored/.svndigest &&exit_fail51 test -e toy_project/dir_to_be_ignored/.svndigest || exit_fail 52 52 53 53 # === testing svncopyright === … … 61 61 echo dummie > toy_project/dir_to_be_ignored/.svndigest/foo.svncopyright-cache 62 62 63 SVNCOPYRIGHT_run 0 --root toy_project /bin--no-report64 test -r toy_project/bin/.svndigest/ Parameter.cc.svncopyright-cache || exit_fail63 SVNCOPYRIGHT_run 0 --root toy_project --no-report 64 test -r toy_project/bin/.svndigest/svnstat.cc.svncopyright-cache || exit_fail 65 65 test -e toy_project/bin/.svndigest/foo.svncopyright-cache && exit_fail 66 66 test -e toy_project/empty/.svndigest/foo.svncopyright-cache && exit_fail … … 68 68 && exit_fail 69 69 test -e toy_project/empty/.svndigest && exit_fail 70 test -e toy_project/dir_to_be_ignored/.svndigest &&exit_fail70 test -e toy_project/dir_to_be_ignored/.svndigest || exit_fail 71 71 72 72 exit_success -
trunk/yat/Makefile.am
r1396 r1423 32 32 noinst_HEADERS += deprecate.h 33 33 noinst_HEADERS += Exception.h 34 noinst_HEADERS += FileUtil.h 34 35 noinst_HEADERS += Option.h 35 36 noinst_HEADERS += OptionArg.h … … 40 41 41 42 42 yat_cc_files = 43 yat_cc_files = 43 44 yat_cc_files += ColumnStream.cc 44 45 yat_cc_files += CommandLine.cc 45 46 yat_cc_files += Exception.cc 47 yat_cc_files += FileUtil.cc 46 48 yat_cc_files += Option.cc 47 49 yat_cc_files += OptionHelp.cc
Note: See TracChangeset
for help on using the changeset viewer.