- Timestamp:
- Jun 4, 2008, 12:05:22 AM (15 years ago)
- Location:
- branches/replacing_gnuplot
- Files:
-
- 7 deleted
- 30 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/replacing_gnuplot/AUTHORS
r519 r646 1 1 $Id$ 2 2 3 Copyright (C) 2005, 2006 Jari Häkkinen3 Copyright (C) 2005, 2006, 2008 Jari Häkkinen 4 4 5 5 Files are copyright by their respective authors. The contributions to … … 25 25 26 26 27 This package is developed and maintained by people at the Department 28 of Theoretical Physics at Lund University, Sweden. 29 30 Jari Häkkinen 31 Peter Johansson 27 This package is developed and maintained by Jari Häkkinen and 28 Peter Johansson. -
branches/replacing_gnuplot/README
r590 r646 16 16 17 17 Directory `bin` contains main program and is location for svndigest 18 binary. Directory `build_support` contains a n autotool macro that is19 used to find APR location. Directory `doc` contains documentation 20 mainly in file `readme.txt`. Most of the code can be found in 21 directory `lib`. Directory `test` contains the code for tests and the 22 test repository (see README.developer).18 binary. Directory `build_support` contains additional autotool macros 19 required for creating the build environment. Directory `doc` contains 20 documentation mainly in file `readme.txt`. Most of the code can be 21 found in directory `lib`. Directory `test` contains the code for tests 22 and the test repository (see README.developer). 23 23 24 24 -
branches/replacing_gnuplot/bin/Makefile.am
r585 r646 30 30 noinst_HEADERS = Parameter.h 31 31 32 LDADD = $(STATICFLAG) @top_builddir@/lib/libsvndigest.la 32 LDADD = @top_builddir@/lib/libsvndigest.la $(SVNDIGEST_LIBS) 33 AM_LDFLAGS = $(STATICFLAG) $(SVNDIGEST_LDFLAGS) 33 34 34 AM_CPPFLAGS = -I@top_srcdir@/lib 35 AM_CPPFLAGS = -I@top_srcdir@/lib $(SVNDIGEST_CPPFLAGS) 36 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 37 35 38 36 39 # install versioned binary (excluding patch version) -
branches/replacing_gnuplot/bin/Parameter.cc
r581 r646 42 42 43 43 Parameter::Parameter( int argc, char *argv[]) 44 { 45 defaults(); 44 : config_file_(""), copyright_(false), force_(false), 45 generate_config_(false), ignore_cache_(false), report_(true), 46 revisions_(false), root_("."), root_node_("."), targetdir_("."), 47 verbose_(false) 48 { 46 49 for (int i=1; i<argc; ++i) { 47 bool ok=false;48 50 std::stringstream ss(argv[i]); 49 51 std::string myargv(""); … … 54 56 if (myargv=="--config-file"){ 55 57 if (value.size()) { 56 config_file_= value; 57 ok=true; 58 config_file_.value()= value; 58 59 } 59 60 else if (++i<argc){ 60 config_file_= std::string(argv[i]); 61 ok=true; 61 config_file_.value()= std::string(argv[i]); 62 } 63 else { 64 missing_argument(myargv); 62 65 } 63 66 } 64 67 else if (myargv=="--copyright"){ 65 copyright_=true; 66 ok=true; 68 copyright_.value()=true; 67 69 } 68 70 else if (myargv=="-f" || myargv=="--force"){ 69 force_=true; 70 ok=true; 71 force_.value()=true; 71 72 } 72 73 else if (myargv=="-g" || myargv=="--generate-config"){ 73 generate_config_=true; 74 ok=true; 74 generate_config_.value()=true; 75 75 } 76 76 else if (myargv=="-h" || myargv=="--help"){ … … 79 79 } 80 80 else if (myargv=="--ignore-cache"){ 81 ignore_cache_=true; 82 ok=true; 81 ignore_cache_.value()=true; 83 82 } 84 83 else if (myargv=="-r" || myargv=="--root"){ 85 84 if (value.size()) { 86 root_= value; 87 ok=true; 85 root_.value()= value; 88 86 } 89 87 else if (++i<argc){ 90 root_= std::string(argv[i]); 91 ok=true; 88 root_.value()= std::string(argv[i]); 89 } 90 else { 91 missing_argument(myargv); 92 92 } 93 93 } 94 94 else if (myargv=="--report") { 95 report_=true; 96 ok=true; 95 report_.value()=true; 97 96 } 98 97 else if (myargv=="--no-report") { 99 report_=false; 100 ok=true; 98 report_.value()=false; 101 99 } 102 100 else if (myargv=="--revisions") { 103 revisions_=true; 104 ok=true; 101 revisions_.value()=true; 105 102 } 106 103 else if (myargv=="-t" || myargv=="--target"){ 107 104 if (value.size()) { 108 targetdir_= value; 109 ok=true; 105 targetdir_.value()= value; 110 106 } 111 107 else if (++i<argc){ 112 targetdir_= std::string(argv[i]); 113 ok=true; 108 targetdir_.value()= std::string(argv[i]); 109 } 110 else { 111 missing_argument(myargv); 114 112 } 115 113 } 116 114 else if (myargv=="-v" || myargv=="--verbose"){ 117 verbose_=true; 118 ok=true; 115 verbose_.value()=true; 119 116 } 120 117 else if (myargv=="--version"){ 121 version _=true;122 ok=true;118 version(); 119 exit(0); 123 120 } 124 121 else if (myargv=="-vf" || myargv=="-fv"){ 125 verbose_=true; 126 force_=true; 127 ok=true; 128 } 129 130 if (!ok) 122 verbose_.value()=true; 123 force_.value()=true; 124 } 125 else { 131 126 throw std::runtime_error("svndigest: invalid option: " + myargv + 132 127 "\nTry `svndigest --help' for usage."); 128 } 129 } 130 131 analyse(); 132 } 133 134 135 void Parameter::analyse(void) 136 { 137 using namespace std; 138 139 string workdir(pwd()); // remember current working directory (cwd). 140 141 if (!node_exist(root_.value())) 142 throw runtime_error(string("svndigest: cannot stat `" + root_.value() + 143 "': no such file or directory")); 144 145 if (access_rights(root_.value(), "r")) 146 throw runtime_error(string("svndigest: cannot open `" + root_.value() + 147 "' for reading: Permission denied")); 148 149 // Check whether root is directory or file 150 struct stat nodestat; 151 stat(root_.value().c_str(), &nodestat); 152 if (S_ISDIR(nodestat.st_mode)) { 153 chdir(root_.value().c_str()); 154 root_node_.value() = root_.value() = pwd(); 133 155 } 134 135 if (version_){ 136 version(verbose_); 137 exit(0); 138 } 139 analyse(); 140 } 141 142 143 void Parameter::analyse(void) 144 { 145 using namespace std; 146 147 string workdir(pwd()); // remember current working directory (cwd). 148 149 bool root_ok = node_exist(root_) && !access_rights(root_, "r"); 150 151 if (root_ok) { 152 // Check that root_ is a directory 153 struct stat nodestat; 154 stat(root_.c_str(), &nodestat); 155 if (!S_ISDIR(nodestat.st_mode)) 156 throw runtime_error(string("svndigest: accessing `") + root_ + 157 "': Not a directory."); 156 else { 157 std::string fname = file_name(root_.value()); 158 root_.value() = directory_name(root_.value()); 159 chdir(root_.value().c_str()); 160 root_.value() = pwd(); 161 root_node_.value() = root_.value() + "/" + fname; 158 162 } 159 160 // Checking that root_ exists and retrieve the absolute path to root_161 if (!root_ok || chdir(root_.c_str()))162 throw runtime_error(string("svndigest: Root directory (") + root_ +163 ") access failed.");164 root_ = pwd();165 166 167 163 168 164 // need to get back to cwd if relative paths are used. … … 172 168 // Checking that targetdir_ exists and retrieve the absolute path 173 169 // to targetdir_ 174 if (chdir(targetdir_.c_str())) 175 throw runtime_error(string("svndigest: Target directory (") + targetdir_ + 176 ") access failed."); 177 targetdir_ = pwd(); 178 // Checking write permissions for targetdir_ 179 if (access_rights(targetdir_,"w")) 180 throw runtime_error(string("svndigest: No write permission on target ") + 181 "directory (" + targetdir_ +")."); 170 if (report()) { 171 if (chdir(targetdir_.value().c_str())) 172 throw runtime_error(string("svndigest: Target directory (") + 173 targetdir_.value() + ") access failed."); 174 targetdir_.value() = pwd(); 175 // Checking write permissions for targetdir_ 176 if (access_rights(targetdir_.value(),"w")) 177 throw runtime_error(string("svndigest: No write permission on target ") + 178 "directory (" + targetdir_.value() +")."); 179 } 182 180 183 181 // return back to cwd … … 191 189 { 192 190 // not default 193 if (!config_file_. empty())194 return config_file_ ;191 if (!config_file_.value().empty()) 192 return config_file_.value(); 195 193 196 194 // default behaviour … … 199 197 200 198 201 void Parameter::defaults(void) 202 { 203 config_file_ = ""; 204 copyright_=false; 205 force_=false; 206 generate_config_=false; 207 ignore_cache_=false; 208 report_=true; 209 revisions_=false; 210 root_="."; 211 targetdir_="."; 212 verbose_=false; 213 version_=false; 214 } 215 216 217 void Parameter::help(void) 218 { 219 defaults(); 220 199 void Parameter::help(void) const 200 { 221 201 ColumnStream cs(std::cout, 1); 222 202 cs.width(0)=79; 223 203 cs.margin(0)=0; 224 204 ColumnStream cs2(std::cout, 2); 225 cs2.width(0)=24; 205 // Widest line should fit exactly 206 cs2.width(0)=21; 226 207 cs2.width(1)=52; 227 208 cs2.margin(0)=2; 209 // Gnits standard suggest three characters gap between option and description 210 cs2.margin(1)=3; 228 211 229 212 std::cout << "Usage: svndigest [OPTION]...\n" … … 235 218 << "short options too.\n"; 236 219 237 cs2 << " --copyright\tupdate copyright statement\n" 238 << " --config-file=ARG\tconfiguration file " 220 cs2 << " --config-file=ARG\tconfiguration file " 239 221 << "[<ROOT>/.svndigest/config]\n" 222 << " --copyright\tupdate copyright statement\n" 240 223 << "-f, --force\tif sub-directory named <ROOT> exists in " 241 224 << "target directory, remove sub-directory before writing results\n" … … 243 226 << "to standard output and exit\n" 244 227 << "-h, --help\tdisplay this help and exit\n" 245 << " --ignore-cache\t Ignore cache files and analyze "228 << " --ignore-cache\tignore cache files and analyze " 246 229 << "everything from repository\n" 247 << " --no-report\t Create no HTML report\n"248 << " --revisions\t Use revision numbers as time scale "230 << " --no-report\tcreate no HTML report\n" 231 << " --revisions\tuse revision numbers as time scale " 249 232 << "instead of dates [dates]\n" 250 233 << "-r, --root=ROOT\tsvn controlled directory to perform " 251 << "statistics calculation on [" << root_ << "]\n" 252 << "-t, --target=TARGET\toutput directory [" << targetdir_ << "]\n" 234 << "statistics calculation on [" << root_.default_value() << "]\n" 235 << "-t, --target=TARGET\toutput directory [" 236 << targetdir_.default_value() << "]\n" 253 237 << "-v, --verbose\texplain what is being done\n" 254 238 << " --version\tprint version information and exit\n"; … … 259 243 260 244 245 void Parameter::missing_argument(std::string opt) const 246 { 247 if (opt.size()>0 && opt[0]=='-') 248 opt = opt.substr(1); 249 if (opt.size()>0 && opt[0]=='-') 250 opt = opt.substr(1); 251 std::stringstream ss; 252 ss << "svndigest: option requires an argument -- " << opt << "\n" 253 << "Try `svndigest --help' for usage."; 254 throw std::runtime_error(ss.str()); 255 } 256 261 257 void Parameter::version(bool verbose) const 262 258 { 263 259 ColumnStream cs(std::cout, 1); 264 260 cs.width(0)=79; 265 cs << PACKAGE_STRING; 266 cs << " ("; 267 if (DEV_BUILD) 268 cs << "r" << svn_revision() << " "; 269 cs << "compiled " << __DATE__ ", " << __TIME__ << ")\n"; 270 261 cs << PACKAGE_STRING << version_string() << "\n"; 271 262 cs << "\nCopyright (C) " << svn_year() 272 263 << " Jari H\u00E4kkinen and Peter Johansson.\n" -
branches/replacing_gnuplot/bin/Parameter.h
r540 r646 26 26 */ 27 27 28 #include "Option.h" 29 28 30 #include <map> 29 31 #include <string> … … 37 39 Parameter( int argc, char *argv[]); 38 40 std::string config_file(void) const; 39 inline bool copyright(void) const { return copyright_ ; }41 inline bool copyright(void) const { return copyright_.value(); } 40 42 /// @todo 41 inline bool force(void) const { return force_; } 42 inline bool generate_config(void) const { return generate_config_; } 43 inline bool ignore_cache(void) const { return ignore_cache_; } 44 inline bool report(void) const { return report_; } 45 inline bool revisions(void) const { return revisions_; } 43 inline bool force(void) const { return force_.value(); } 44 inline bool generate_config(void) const { return generate_config_.value(); } 45 // Until we fix caching (#313) ignore caching 46 //inline bool ignore_cache(void) const { return ignore_cache_.value(); } 47 inline bool ignore_cache(void) const { return true; } 48 inline bool report(void) const { return report_.value(); } 49 inline bool revisions(void) const { return revisions_.value(); } 46 50 /// @return absolute path to root directory 47 inline const std::string& root(void) const { return root_; } 51 inline const std::string& root(void) const { return root_.value(); } 52 /// @return absolute path to root node 53 inline const std::string& root_node(void) const {return root_node_.value();} 48 54 /// @return absolute path to target directory 49 inline const std::string& targetdir(void) const { return targetdir_; } 50 inline bool verbose(void) const { return verbose_; } 55 inline const std::string& targetdir(void) const 56 { return targetdir_.value(); } 57 inline bool verbose(void) const { return verbose_.value(); } 51 58 52 59 private: 53 60 void analyse(void); 54 void defaults(void);55 void help(void);61 void help(void) const; 62 void missing_argument(std::string opt) const; 56 63 void version(bool=false) const; 57 64 58 std::stringconfig_file_;59 boolcopyright_;60 boolforce_;61 boolgenerate_config_;62 boolignore_cache_;63 boolreport_;64 boolrevisions_;65 std::stringroot_;66 std::string targetdir_;67 bool verbose_;68 bool version_;65 Option<std::string> config_file_; 66 Option<bool> copyright_; 67 Option<bool> force_; 68 Option<bool> generate_config_; 69 Option<bool> ignore_cache_; 70 Option<bool> report_; 71 Option<bool> revisions_; 72 Option<std::string> root_; 73 Option<std::string> root_node_; 74 Option<std::string> targetdir_; 75 Option<bool> verbose_; 69 76 }; 70 77 -
branches/replacing_gnuplot/bin/svndigest.cc
r579 r646 160 160 if (option->verbose()) 161 161 std::cout << "Generating output" << std::endl; 162 if (!option->revisions()) 163 GnuplotFE::instance()->set_dates(SVNlog(repo).date()); 162 if (!option->revisions()) { 163 SVNlog log(repo); 164 std::vector<std::string> dates; 165 dates.reserve(log.commits().size()); 166 for (size_t i=0; i<log.commits().size(); ++i) { 167 assert(static_cast<svn_revnum_t>(i)==log.commits()[i].revision()); 168 dates.push_back(log.commits()[i].date()); 169 } 170 GnuplotFE::instance()->set_dates(dates); 171 } 164 172 chdir(option->targetdir().c_str()); 165 173 mkdir(tree->name()); -
branches/replacing_gnuplot/build_support/move-if-change
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
branches/replacing_gnuplot/build_support/version.m4
r585 r646 1 1 ## $Id$ 2 2 # 3 # Copyright (C) 2008 Peter Johansson3 # Copyright (C) 2008 Jari Häkkinen, Peter Johansson 4 4 # 5 5 # This file is part of svndigest, http://trac.thep.lu.se/svndigest … … 31 31 m4_define([PATCH_VERSION], [0]) 32 32 33 # DEV_BUILD - When rolling a tarball we set this to `false'. In33 # SVNDIGEST_DEV_BUILD - When rolling a tarball we set this to `false'. In 34 34 # repository value remains `true'. 35 35 m4_define([SVNDIGEST_DEV_BUILD], [true]) … … 45 45 m4_define([SVNDIGEST_VERSION], m4_if(PATCH_VERSION,[0], SVNDIGEST_VERSION, 46 46 SVNDIGEST_VERSION.PATCH_VERSION)) 47 m4_define([SVNDIGEST_VERSION], m4_if(DEV_BUILD,[true], [pre]SVNDIGEST_VERSION, 48 SVNDIGEST_VERSION)) 47 m4_define([SVNDIGEST_VERSION], m4_if(SVNDIGEST_DEV_BUILD, 48 [true], [pre]SVNDIGEST_VERSION, 49 SVNDIGEST_VERSION)) 49 50 -
branches/replacing_gnuplot/configure.ac
r606 r646 76 76 AC_CHECK_PROG([GNUPLOT],[gnuplot],[ok]) 77 77 78 # Save FLAGS 79 SAVE_CPPFLAGS="$CPPFLAGS" 80 SAVE_CXXFLAGS="$CXXFLAGS" 81 SAVE_LDFLAGS="$LDFLAGS" 82 SAVE_LIBS="$LIBS" 83 78 84 # -Wno-long-long is needed to suppress compiler diagnostics regarding 79 85 # using extension beyond the C++ standard (usage of non C++ standard 80 86 # 'long long' types). 81 CXXFLAGS="$CXXFLAGS-Wall -pedantic -Wno-long-long"87 SD_CXXFLAGS="$SD_CXXFLAGS-Wall -pedantic -Wno-long-long" 82 88 AC_TYPE_LONG_LONG_INT() 83 89 84 90 AC_ARG_ENABLE(debug, 85 91 [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], 86 [ CXXFLAGS="$CXXFLAGS -g -O"],87 [ CPPFLAGS="$CPPFLAGS -DNDEBUG" CXXFLAGS="$CXXFLAGS -O3"])92 [SD_CXXFLAGS="$SD_CXXFLAGS -g -O"], 93 [SD_CPPFLAGS="-DNDEBUG" SD_CXXFLAGS="$SD_CXXFLAGS -O3"]) 88 94 89 95 # optionally prepare for building static libraries. … … 98 104 # Keychain on Mac OSX. In consequence the below 99 105 # frameworks are needed for succesful static builds. 100 LIBS="$LIBS -framework Security"101 LIBS="$LIBS -framework CoreFoundation"102 LIBS="$LIBS -framework CoreServices"106 SD_LIBS="$SD_LIBS -framework Security" 107 SD_LIBS="$SD_LIBS -framework CoreFoundation" 108 SD_LIBS="$SD_LIBS -framework CoreServices" 103 109 ;; 104 110 esac … … 118 124 # AC_SEARCH_LIBS([apr_allocator_create],[apr-0],,apr_found="no") but 119 125 # apr-0 must be prior knowledge. 120 sinclude(./build_support/find_apr.m4)126 m4_sinclude(./build_support/find_apr.m4) 121 127 APR_FIND_APR(,,1,[1 0]) 122 128 if test "$apr_found" = "yes" ; then 123 LDFLAGS="`$apr_config --link-ld` $LDFLAGS" 124 CPPFLAGS="`$apr_config --includes` $CPPFLAGS" 125 AC_CHECK_HEADER([apr_allocator.h],,apr_found="no") 129 SD_LDFLAGS="`$apr_config --link-ld` $SD_LDFLAGS" 130 SD_CPPFLAGS="`$apr_config --includes --cppflags` $SD_CPPFLAGS" 126 131 fi 127 132 … … 130 135 AC_ARG_WITH(svn, 131 136 [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])], 132 [ LDFLAGS="-L$withval/lib $LDFLAGS" CPPFLAGS="-I$withval/include $CPPFLAGS"]) 137 [ SD_LDFLAGS="-L$withval/lib $SD_LDFLAGS" 138 SD_CPPFLAGS="-I$withval/include $SD_CPPFLAGS"]) 139 140 141 # Use SD_*FLAGS in tests 142 CPPFLAGS="$SD_CPPFLAGS $CPPFLAGS" 143 CXXFLAGS="$SD_CXXFLAGS $CXXFLAGS" 144 LDFLAGS="$SD_LDFLAGS $LDFLAGS" 145 LIBS="$SD_LIBS $LIBS" 146 147 AC_CHECK_HEADER([apr_allocator.h],,apr_found="no") 133 148 AC_CHECK_HEADER([subversion-1/svn_types.h],,svn_found="no") 134 149 # The library checks below may match shared libs even when … … 136 151 # pose any problems since in a properly installed system the shared 137 152 # and static libraries should be the same. 138 AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],,svn_found="no") 139 AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1],,svn_found="no") 140 AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1],,svn_found="no") 141 AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],,svn_found="no") 142 AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,svn_found="no") 143 153 AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1], 154 [SD_LIBS="-lsvn_subr-1 $SD_LIBS"],svn_found="no") 155 AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], 156 [SD_LIBS="-lsvn_ra-1 $SD_LIBS"],svn_found="no") 157 AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], 158 [SD_LIBS="-lsvn_wc-1 $SD_LIBS"],svn_found="no") 159 AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1], 160 [SD_LIBS="-lsvn_diff-1 $SD_LIBS"],svn_found="no") 161 AC_SEARCH_LIBS([svn_client_log3],[svn_client-1], 162 [SD_LIBS="-lsvn_client-1 $SD_LIBS"],svn_found="no") 163 164 # Export flags 165 AC_SUBST([SVNDIGEST_CPPFLAGS], $SD_CPPFLAGS) 166 AC_SUBST([SVNDIGEST_CXXFLAGS], $SD_CXXFLAGS) 167 AC_SUBST([SVNDIGEST_LDFLAGS], $SD_LDFLAGS) 168 AC_SUBST([SVNDIGEST_LIBS], $SD_LIBS) 169 170 # Reset FLAGS 171 CPPFLAGS="$SAVE_CPPFLAGS" 172 CXXFLAGS="$SAVE_CXXFLAGS" 173 LDFLAGS="$SAVE_LDFLAGS" 174 LIBS="$SAVE_LIBS" 144 175 145 176 # check if svnversion is installed … … 147 178 AC_PATH_PROG(SVNVERSION, svnversion, have_svnversion="no") 148 179 180 # checking if we build in a subversion WC 149 181 wc_found="no"; 150 182 if (test $have_svnversion != "no" && … … 155 187 AC_CHECK_FILE("$srcdir/lib/subversion_info.cc",info_found="yes",info_found="no") 156 188 157 # Checking that a release (non-dev) has no pre in VERSION189 # checking that DEV_BUILD is set to false at time of release 158 190 # Failure should be captured by distcheck 159 if (test "$wc_found" = "no" && test "$DEV_BUILD" = "yes") ; then 160 AC_MSG_ERROR([Incorrect version number: $VERSION 161 Version number of an official release should have format 162 MAJOR.MINOR or MAJOR.MINOR.PATCH]) 163 fi 191 if (test "$wc_found" = "no" && test "$SVNDIGEST_DEV_BUILD" = "true") ; then 192 AC_MSG_ERROR([Incorrect version: 193 [SVNDIGEST_DEV_BUILD] is set to SVNDIGEST_DEV_BUILD. 194 [SVNDIGEST_DEV_BUILD] should be set to false at time of release. 195 Please, update version.m4.]) 196 fi 197 164 198 165 199 # devel version should have svn WC and SVNVERSION installed … … 249 283 AC_MSG_NOTICE([ The following flags and libs will be used:]) 250 284 AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) 251 AC_MSG_NOTICE([ Compiler: CXX=\"$CXX\"])252 AC_MSG_NOTICE([ Preprocessor flags: CPPFLAGS=\"$CPPFLAGS\"])253 AC_MSG_NOTICE([ C++ flags: CXXFLAGS=\"$CXXFLAGS\"])254 AC_MSG_NOTICE([ Linker flags: LDFLAGS=\"$LDFLAGS\"])255 AC_MSG_NOTICE([ LIBS: LIBS=\"$LIBS\"])285 AC_MSG_NOTICE([ Compiler: $CXX]) 286 AC_MSG_NOTICE([ Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS]) 287 AC_MSG_NOTICE([ C++ flags: $SD_CXXFLAGS $CXXFLAGS]) 288 AC_MSG_NOTICE([ Linker flags: $SD_LDFLAGS $LDFLAGS]) 289 AC_MSG_NOTICE([ LIBS: $SD_LIBS $LIBS]) 256 290 AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) 257 291 AC_MSG_NOTICE([]) -
branches/replacing_gnuplot/lib/AddStats.cc
r552 r646 60 60 typedef std::set<svn_revnum_t> RevSet; 61 61 RevSet revs; 62 std:: copy(log.revision().begin(), log.revision().end(),63 std::inserter(revs, revs.begin()));62 std::transform(log.commits().begin(), log.commits().end(), 63 std::inserter(revs, revs.begin()), GetRevision()); 64 64 for (RevSet::iterator rev_iter=revs.begin();rev_iter!=revs.end();++rev_iter){ 65 65 SVNblame svn_blame(path, *rev_iter); -
branches/replacing_gnuplot/lib/BlameStats.cc
r589 r646 82 82 typedef std::set<svn_revnum_t> RevSet; 83 83 RevSet revs; 84 std:: copy(log.revision().begin(), log.revision().end(),85 std::inserter(revs, revs.begin()));84 std::transform(log.commits().begin(), log.commits().end(), 85 std::inserter(revs, revs.begin()), GetRevision()); 86 86 for (RevSet::iterator rev_iter=revs.begin();rev_iter!=revs.end();++rev_iter){ 87 87 SVNblame svn_blame(path, *rev_iter); -
branches/replacing_gnuplot/lib/ColumnStream.h
r519 r646 6 6 /* 7 7 Copyright (C) 2007 Peter Johansson 8 Copyright (C) 2008 Jari Häkkinen 8 9 9 10 This file is part of svndigest, http://trac.thep.lu.se/svndigest … … 24 25 02111-1307, USA. 25 26 */ 26 #include <fstream> 27 28 #include <iosfwd> 27 29 #include <sstream> 28 30 #include <vector> -
branches/replacing_gnuplot/lib/Commitment.cc
r519 r646 36 36 37 37 Commitment::Commitment(std::string author, std::string date, 38 std::string msg, s ize_t rev)38 std::string msg, svn_revnum_t rev) 39 39 : author_(author), date_(date), msg_(msg), rev_(rev) 40 40 { -
branches/replacing_gnuplot/lib/Commitment.h
r519 r646 27 27 #include <string> 28 28 29 #include <subversion-1/svn_types.h> 30 29 31 namespace theplu { 30 32 namespace svndigest { … … 48 50 */ 49 51 Commitment(std::string author, std::string date, std::string msg, 50 s ize_t rev);52 svn_revnum_t rev); 51 53 52 54 /** 53 55 \return Author 54 56 */ 55 inline std::stringauthor(void) const { return author_; }57 inline const std::string& author(void) const { return author_; } 56 58 57 59 /** 58 60 \return Date 59 61 */ 60 inline std::stringdate(void) const { return date_; }62 inline const std::string& date(void) const { return date_; } 61 63 62 64 /** 63 65 \return Message 64 66 */ 65 inline std::stringmessage(void) const { return msg_; }67 inline const std::string& message(void) const { return msg_; } 66 68 67 69 /** 68 70 \return Revision 69 71 */ 70 inline s ize_t revision(void) const { return rev_; }72 inline svn_revnum_t revision(void) const { return rev_; } 71 73 72 74 private: … … 80 82 std::string date_; 81 83 std::string msg_; 82 s ize_t rev_;84 svn_revnum_t rev_; 83 85 84 86 }; … … 91 93 }; 92 94 95 struct GetAuthor 96 { 97 inline const std::string& operator()(const Commitment& commit) const 98 { return commit.author(); } 99 }; 100 101 struct GetRevision 102 { 103 inline svn_revnum_t operator()(const Commitment& commit) const 104 { return commit.revision(); } 105 }; 106 93 107 }} // end of namespace svndigest and namespace theplu 94 108 -
branches/replacing_gnuplot/lib/File.cc
r597 r646 41 41 #include <iostream> 42 42 #include <map> 43 #include <stdexcept> 43 44 #include <string> 44 45 #include <sys/stat.h> … … 66 67 const Stats& stats = stats_["add"]; 67 68 68 69 for (LogIterator i=log. begin(); i<log.end(); ++i){69 typedef std::vector<Commitment>::iterator LogIterator; 70 for (LogIterator i=log.commits().begin(); i<log.commits().end(); ++i){ 70 71 if (i->revision() && 71 72 (stats(LineTypeParser::code, i->author(), i->revision()) > … … 183 184 std::string cache_dir = directory_name(path()) + std::string(".svndigest/"); 184 185 std::string cache_file = cache_dir + name()+std::string(".svndigest-cache"); 185 if ( node_exist(cache_file)){186 if (!ignore && node_exist(cache_file)){ 186 187 std::ifstream is(cache_file.c_str()); 187 188 if (stats_.load_cache(is)){ … … 190 191 is.close(); 191 192 } 192 else 193 else { 193 194 stats_.parse(path_); 195 } 194 196 if (!node_exist(cache_dir)) 195 197 mkdir(cache_dir); … … 262 264 if (*line_type==LineTypeParser::other) 263 265 os << "line-other"; 264 else if (*line_type==LineTypeParser::comment) 266 else if (*line_type==LineTypeParser::comment || 267 *line_type==LineTypeParser::copyright) 265 268 os << "line-comment"; 266 else 269 else if (*line_type==LineTypeParser::code) 267 270 os << "line-code"; 271 else { 272 std::string msg="File::print_blame(): unexpected line type found"; 273 throw std::runtime_error(msg); 274 } 268 275 os << "\">" << blame.line_no()+1 269 276 << "</td>\n<td>"; … … 313 320 const SVNlog& log) const 314 321 { 315 std::string outpath = stats_type+"/"+user+"/"+line_type+"/"+local_path(); 322 std::string lpath = local_path(); 323 if (lpath.empty()) 324 lpath = "index"; 325 std::string outpath = stats_type+"/"+user+"/"+line_type+"/"+lpath; 316 326 std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+ 317 l ocal_path_+".png";327 lpath+".png"; 318 328 std::string html_name(outpath + ".html"); 319 329 std::ofstream os(html_name.c_str()); 320 print_header(os, name(), level_+3, user, line_type, l ocal_path()+".html",330 print_header(os, name(), level_+3, user, line_type, lpath+".html", 321 331 stats_type); 322 332 path_anchor(os); 323 324 333 os << "<p class=\"plot\">\n<img src='"; 325 334 for (size_t i=0; i<level_; ++i) -
branches/replacing_gnuplot/lib/Makefile.am
r606 r646 24 24 # 02111-1307, USA. 25 25 26 AM_CPPFLAGS = $(SVNDIGEST_CPPFLAGS) 27 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 28 26 29 noinst_LTLIBRARIES = libsvndigest.la 27 30 … … 30 33 Date.h Directory.h File.h first_page.h Functor.h Gnuplot.h GnuplotFE.h \ 31 34 HtmlBuf.h HtmlStream.h html_utility.h LineTypeParser.h \ 32 LogIterator.h Node.h rmdirhier.h \35 Node.h Option.h rmdirhier.h \ 33 36 Stats.h StatsCollection.h subversion_info.h SVN.h SVNblame.h \ 34 37 SVNinfo.h SVNlog.h SVNproperty.h Trac.h utility.h … … 39 42 css.cc Date.cc Directory.cc File.cc first_page.cc\ 40 43 Functor.cc Gnuplot.cc GnuplotFE.cc HtmlBuf.cc HtmlStream.cc \ 41 html_utility.cc LineTypeParser.cc LogIterator.ccNode.cc \44 html_utility.cc LineTypeParser.cc Node.cc \ 42 45 rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc \ 43 46 SVNblame.cc SVNinfo.cc SVNlog.cc SVNproperty.cc Trac.cc utility.cc -
branches/replacing_gnuplot/lib/Node.cc
r589 r646 76 76 if (ignore()) 77 77 return svninfo_.last_changed_author(); 78 assert(log(). author().size());79 return log(). author().back();78 assert(log().commits().size()); 79 return log().commits().back().author(); 80 80 } 81 81 … … 143 143 if (ignore()) 144 144 return svninfo_.last_changed_rev(); 145 assert(log(). revision().size());146 return log(). revision().back();145 assert(log().commits().size()); 146 return log().commits().back().revision(); 147 147 } 148 148 -
branches/replacing_gnuplot/lib/SVN.cc
r579 r646 30 30 #include <vector> 31 31 32 #include < iostream>32 #include <cassert> 33 33 34 34 #include <apr_allocator.h> -
branches/replacing_gnuplot/lib/SVNlog.cc
r519 r646 25 25 26 26 #include "Commitment.h" 27 #include "LogIterator.h"28 27 #include "SVN.h" 29 28 … … 39 38 SVNlog::SVNlog(void) 40 39 { 41 assert(date().empty());42 assert(author().empty());43 assert(revision().empty());44 assert(message().empty());45 40 } 46 41 … … 50 45 SVN::instance()->client_log(path, log_message_receiver, 51 46 static_cast<void*>(&lb_)); 52 assert(date().size()==author().size());53 assert(date().size()==revision().size());54 assert(date().size()==message().size());55 47 } 56 48 … … 61 53 62 54 63 LogIterator SVNlog::begin() const55 bool SVNlog::exist(std::string name) const 64 56 { 65 return LogIterator(*this, 0); 57 58 std::vector<Commitment>::const_reverse_iterator iter = commits().rbegin(); 59 for ( ; iter!= commits().rend(); ++iter) 60 if (iter->author() == name) 61 return true; 62 return false; 66 63 } 67 64 68 65 69 LogIterator SVNlog::end() const66 const Commitment& SVNlog::latest_commit(void) const 70 67 { 71 return LogIterator(*this, revision().size());68 return commits().back(); 72 69 } 73 70 74 71 75 bool SVNlog::exist(std::string name) const72 const Commitment& SVNlog::latest_commit(std::string name) const 76 73 { 77 std::vector<std::string>::const_reverse_iterator iter = 78 find(author().rbegin(), author().rend(), name); 79 return iter!=author().rend(); 80 } 81 82 83 Commitment SVNlog::latest_commit(void) const 84 { 85 return Commitment(author().back(), date().back(), 86 message().back(), revision().back()); 87 88 } 89 90 91 Commitment SVNlog::latest_commit(std::string name) const 92 { 93 std::vector<std::string>::const_reverse_iterator iter = 94 find(author().rbegin(), author().rend(), name); 95 size_t dist(std::distance(iter, author().rend())); 96 if (!dist) { 97 Commitment c; 98 assert(false); 99 return c; 100 } 101 return Commitment(author()[dist-1], date()[dist-1], 102 message()[dist-1], revision()[dist-1]); 103 104 } 105 106 107 void SVNlog::push_back(const Commitment& c) 108 { 109 lb_.authors.push_back(c.author()); 110 lb_.commit_dates.push_back(c.date()); 111 lb_.msg.push_back(c.message()); 112 lb_.rev.push_back(c.revision()); 113 } 114 115 116 void SVNlog::reserve(size_t i) 117 { 118 lb_.authors.reserve(i); 119 lb_.commit_dates.reserve(i); 120 lb_.msg.reserve(i); 121 lb_.rev.reserve(i); 74 std::vector<Commitment>::const_reverse_iterator iter = commits().rbegin(); 75 for ( ; iter!= commits().rend(); ++iter) 76 if (iter->author() == name) 77 return *iter; 78 assert(false); 122 79 } 123 80 … … 130 87 { 131 88 struct log_receiver_baton *lb=static_cast<struct log_receiver_baton*>(baton); 132 if (date && date[0]) 133 lb->commit_dates.push_back(date); 134 else 89 if (!date || !date[0]) 135 90 throw SVNException("No date defined for revision: " + rev); 91 std::string a; 136 92 if (author && author[0]) 137 lb->authors.push_back(author); 138 else 139 lb->authors.push_back(""); 140 lb->rev.push_back(rev); 93 a=author; 94 std::string message; 141 95 if (msg) 142 lb->msg.push_back(std::string(msg)); 143 else 144 lb->msg.push_back(std::string("")); 96 message = msg; 97 lb->commits.push_back(Commitment(a, date, message, rev)); 145 98 return SVN_NO_ERROR; 146 99 } … … 149 102 void SVNlog::swap(SVNlog& rhs) 150 103 { 151 lb_.authors.swap(rhs.lb_.authors); 152 lb_.commit_dates.swap(rhs.lb_.commit_dates); 153 lb_.msg.swap(rhs.lb_.msg); 154 lb_.rev.swap(rhs.lb_.rev); 104 lb_.commits.swap(rhs.lb_.commits); 155 105 } 156 106 … … 159 109 { 160 110 SVNlog log; 161 LogIterator lhs_iter(lhs.begin());162 LogIterator rhs_iter(rhs.begin());163 while(lhs_iter<lhs. end() && rhs_iter<rhs.end()) {111 std::vector<Commitment>::iterator lhs_iter=lhs.commits().begin(); 112 std::vector<Commitment>::const_iterator rhs_iter=rhs.commits().begin(); 113 while(lhs_iter<lhs.commits().end() && rhs_iter<rhs.commits().end()) { 164 114 if (lhs_iter->revision() < rhs_iter->revision()) { 165 115 166 log. push_back(*lhs_iter);116 log.commits().push_back(*lhs_iter); 167 117 ++lhs_iter; 168 118 } 169 119 else if (rhs_iter->revision()<lhs_iter->revision()) { 170 log. push_back(*rhs_iter);120 log.commits().push_back(*rhs_iter); 171 121 ++rhs_iter; 172 122 } 173 123 else { 174 log. push_back(*lhs_iter);124 log.commits().push_back(*lhs_iter); 175 125 ++lhs_iter; 176 126 ++rhs_iter; 177 127 } 178 128 } 179 while(lhs_iter<lhs. end()) {180 log.push_back(*lhs_iter);181 129 while(lhs_iter<lhs.commits().end()) { 130 log.commits().push_back(*lhs_iter); 131 ++lhs_iter; 182 132 } 183 while(rhs_iter<rhs. end()) {184 log.push_back(*rhs_iter);185 133 while(rhs_iter<rhs.commits().end()) { 134 log.commits().push_back(*rhs_iter); 135 ++rhs_iter; 186 136 } 187 137 lhs.swap(log); -
branches/replacing_gnuplot/lib/SVNlog.h
r519 r646 28 28 29 29 #include "Commitment.h" 30 #include "LogIterator.h"31 30 32 31 #include <string> … … 43 42 The SVNlog class is a utility class for taking care of 'svn 44 43 log' information. An 'svn log' is performed on an item, the 45 log information for each revision is stored in vectors.44 log information for each revision is a vector<Commitment>. 46 45 */ 47 46 class SVNlog { 48 47 public: 49 50 48 /** 51 49 Default constructor. Creates empty log. … … 67 65 68 66 /** 69 \return Authors67 \return Commitments 70 68 */ 71 inline const std::vector< std::string>& author(void) const72 { return lb_. authors; }69 inline const std::vector<Commitment>& commits(void) const 70 { return lb_.commits; } 73 71 74 72 /** 75 */ 76 LogIterator begin(void) const; 77 78 /** 79 \return Dates 73 \return Commitments 80 74 */ 81 inline const std::vector<std::string>& date(void) const 82 { return lb_.commit_dates; } 83 84 /** 85 */ 86 LogIterator end(void) const; 75 inline std::vector<Commitment>& commits(void) 76 { return lb_.commits; } 87 77 88 78 /** … … 92 82 93 83 /** 94 \return Messages95 */96 inline const std::vector<std::string>& message(void) const97 { return lb_.msg; }98 99 /**100 84 \return Latest commit 101 85 */ 102 Commitmentlatest_commit(void) const;86 const Commitment& latest_commit(void) const; 103 87 104 88 /** … … 106 90 empty Commitment (default constructor) is returned. 107 91 */ 108 Commitment latest_commit(std::string author) const; 109 110 /** 111 \return Revisions 112 */ 113 inline const std::vector<size_t>& revision(void) const 114 { return lb_.rev; } 115 116 /** 117 */ 118 void push_back(const Commitment&); 119 120 /** 121 */ 122 void reserve(size_t i); 92 const Commitment& latest_commit(std::string author) const; 123 93 124 94 /** … … 142 112 */ 143 113 struct log_receiver_baton { 144 std::vector<std::string> authors; 145 std::vector<std::string> commit_dates; 146 std::vector<std::string> msg; 147 std::vector<size_t> rev; 114 std::vector<Commitment> commits; 148 115 } lb_; 149 116 -
branches/replacing_gnuplot/lib/Stats.cc
r589 r646 57 57 revision_=svn_info.rev(); 58 58 last_changed_rev_=svn_info.last_changed_rev(); 59 reset(); 59 60 } 60 61 … … 68 69 { 69 70 if (vec.empty()){ 70 vec.resize(last_changed_rev(),0); 71 return; 72 } 73 std::partial_sum(vec.begin(),vec.end(),vec.begin()); 71 // just to allow call to vec.back() below 72 vec.resize(1,0); 73 } 74 else 75 std::partial_sum(vec.begin(),vec.end(),vec.begin()); 74 76 // static_cast to remove annoying compiler warning 75 77 if (vec.size() < static_cast<size_t>(revision()+1)) 76 vec. insert(vec.end(), revision()+1-vec.size(), vec.back());78 vec.resize(revision()+1, vec.back()); 77 79 } 78 80 … … 100 102 add_author(user); 101 103 102 // FIXME: Peter, remove repeat 103 std::vector<unsigned int>& code = code_stats()[user]; 104 if (code.size() < rev+1){ 105 code.reserve(rev+1); 106 code.resize(rev); 107 if (lt == LineTypeParser::code) 108 code.push_back(n); 109 else 110 code.push_back(0); 104 add(code_stats()[user], rev, lt==LineTypeParser::code, n); 105 add(comment_stats()[user], rev, lt==LineTypeParser::comment, n); 106 add(other_stats()[user], rev, lt==LineTypeParser::other, n); 107 add(copyright_stats()[user], rev, lt==LineTypeParser::copyright, n); 108 } 109 110 111 void Stats::add(std::vector<unsigned int>& vec, unsigned int rev, bool x, 112 unsigned int n) 113 { 114 if (vec.size() < rev+1){ 115 vec.reserve(rev+1); 116 vec.resize(rev); 117 if (x) { 118 assert(vec.size()+1<vec.max_size()); 119 vec.push_back(n); 120 } 121 else { 122 assert(vec.size()+1<vec.max_size()); 123 vec.push_back(0); 124 } 111 125 } 112 else if (lt == LineTypeParser::code) 113 code[rev]+=n; 114 115 std::vector<unsigned int>& comments = comment_stats()[user]; 116 if (comments.size() < rev+1){ 117 comments.reserve(revision() + 1); 118 comments.insert(comments.end(), rev - comments.size(), 0); 119 if (lt == LineTypeParser::comment) 120 comments.push_back(n); 121 else 122 comments.push_back(0); 123 } 124 else if (lt == LineTypeParser::comment) 125 comments[rev]+=n; 126 127 std::vector<unsigned int>& other = other_stats()[user]; 128 if (other.size() < rev+1){ 129 other.reserve(revision() + 1); 130 other.insert(other.end(), rev - other.size(), 0); 131 if (lt == LineTypeParser::other) 132 other.push_back(n); 133 else 134 other.push_back(0); 135 } 136 else if (lt == LineTypeParser::other) 137 other[rev]+=n; 138 139 std::vector<unsigned int>& copy = copyright_stats()[user]; 140 if (copy.size() < rev+1){ 141 copy.reserve(revision() + 1); 142 copy.insert(copy.end(), rev - copy.size(), 0); 143 if (lt == LineTypeParser::copyright) 144 copy.push_back(n); 145 else 146 copy.push_back(0); 147 } 148 else if (lt == LineTypeParser::copyright) 149 copy[rev]+=n; 150 } 126 else if (x) 127 vec[rev]+=n; 128 } 151 129 152 130 … … 279 257 std::string name; 280 258 std::getline(is, name); 281 if (name.empty())282 continue;283 259 std::vector<unsigned int>& vec=m[name]; 284 svn_revnum_t rev=0; 285 while (rev < last_changed_rev() && is.good()) { 286 unsigned int count; 287 is >> count; 288 if ( rev+1 > static_cast<svn_revnum_t>(vec.size()) ) 260 std::string line; 261 std::getline(is, line); 262 std::stringstream ss(line); 263 while (ss.good()) { 264 svn_revnum_t rev=0; 265 unsigned int count=0; 266 ss >> rev; 267 ss >> count; 268 if (!count) 269 break; 270 if (rev+1 < static_cast<svn_revnum_t>(vec.size()) ) 289 271 vec.resize(rev+1); 290 vec[rev] =count;291 is >> rev;292 }272 vec[rev]=count; 273 } 274 accumulate(vec); 293 275 } 294 276 } … … 359 341 calc_total(); 360 342 calc_all(); 343 assert(total_stats().size()); 344 assert(code_stats().size()); 345 assert(comment_or_copy_stats().size()); 346 assert(other_stats().size()); 361 347 } 362 348 … … 364 350 const std::string& linetype) const 365 351 { 352 assert(total_stats().size()); 366 353 plot_init(filename); 367 354 GnuplotFE* gp=GnuplotFE::instance(); … … 490 477 os << cache_check_str() << "\n"; 491 478 os << last_changed_rev() << " "; 492 os << authors().size() << " 479 os << authors().size() << "\n"; 493 480 494 481 std::copy(authors().begin(), authors().end(), … … 506 493 for (A2VConstIter i(m.begin()); i!=m.end(); ++i){ 507 494 os << i->first << "\n"; 508 os << i->second.front() << " "; 509 for (size_t j=1; j<i->second.size(); ++j) 510 if (i->second[j] != i->second[j-1]) 495 assert(i->second.size()); 496 if (i->second[0]) 497 os << 0 << " " << i->second[0] << " "; 498 for (size_t j=1; j<i->second.size(); ++j) { 499 // only print if stats changes in this rev 500 if (i->second[j] != i->second[j-1]) { 511 501 os << j << " " << i->second[j] - i->second[j-1] << " "; 512 os << last_changed_rev()+1 << " "; 502 } 503 } 504 os << "\n"; 513 505 } 514 506 } … … 518 510 for (size_t i=0; i<stats_.size(); ++i){ 519 511 stats_[i].clear(); 520 std::vector<unsigned int> vec; 521 stats_[i]["all"] = vec; 512 stats_[i]["all"]=std::vector<unsigned int>(revision_+1); 522 513 } 523 514 authors_.clear(); … … 538 529 539 530 540 size_t Stats::operator()(int linetype, std::string author, size_t rev) const 531 size_t Stats::operator()(int linetype, std::string author, 532 svn_revnum_t rev) const 541 533 { 542 534 assert(linetype<=LineTypeParser::total); 535 assert(static_cast<size_t>(linetype) < stats_.size()); 536 assert(rev>=0); 543 537 A2VConstIter i = stats_[linetype].find(author); 544 if (i==stats_[linetype].end()) 545 throw std::runtime_error(author + " does not exist"); 538 if (i==stats_[linetype].end()){ 539 std::stringstream msg; 540 msg << __FILE__ << ": author: " << author << " does not exist"; 541 throw std::runtime_error(msg.str()); 542 } 543 assert(rev < static_cast<svn_revnum_t>(i->second.size())); 546 544 return i->second[rev]; 547 545 } -
branches/replacing_gnuplot/lib/Stats.h
r589 r646 142 142 \throw if \a author does not exist 143 143 */ 144 size_t operator()(int linetype, std::string author, s ize_t rev) const;144 size_t operator()(int linetype, std::string author, svn_revnum_t rev) const; 145 145 146 146 protected: … … 200 200 private: 201 201 void accumulate(std::vector<unsigned int>& vec) const; 202 void add(std::vector<unsigned int>& vec, unsigned int rev, bool x, 203 unsigned int n); 204 202 205 virtual void do_parse(const std::string&)=0; 203 206 -
branches/replacing_gnuplot/lib/first_page.cc
r556 r646 59 59 using namespace std; 60 60 set<string> authors; 61 authors.insert(log.author().begin(), log.author().end()); 61 std::transform(log.commits().begin(), log.commits().end(), 62 std::inserter(authors, authors.begin()), GetAuthor()); 62 63 // erase invalid authors 63 64 authors.erase(""); … … 82 83 size_t nof_authors, std::string url) 83 84 { 84 assert(log. date().size());85 Date begin(log. date()[0]);86 Date end(log. date().back());85 assert(log.commits().size()); 86 Date begin(log.commits()[0].date()); 87 Date end(log.commits().back().date()); 87 88 std::string timefmt("%a, %e %b %Y %H:%M:%S"); 88 89 … … 101 102 os << end.difftime(begin); 102 103 os << "</td></tr>\n" 103 << "<tr><td>Smallest Revision:</td><td>" << log. revision()[0]104 << "</td></tr>\n" 105 << "<tr><td>Largest Revision:</td><td>" << log.revision().back()106 << "</td></tr>\n" 107 << "<tr><td>Revision Count:</td><td>" << log. revision().size()104 << "<tr><td>Smallest Revision:</td><td>" << log.commits()[0].revision() 105 << "</td></tr>\n" 106 << "<tr><td>Largest Revision:</td><td>" <<log.commits().back().revision() 107 << "</td></tr>\n" 108 << "<tr><td>Revision Count:</td><td>" << log.commits().size() 108 109 << "</td></tr>\n" 109 110 << "<tr><td>Number of Authors:</td><td>" << nof_authors … … 154 155 155 156 os << "</table></div>\n"; 156 157 157 } 158 158 … … 166 166 << "</th></tr></thead>\n"; 167 167 168 std::vector<std::string>::const_reverse_iterator a=log.author().rbegin();169 std::vector<std::string>::const_reverse_iterator d=log.date().rbegin();170 std::vector<std::string>::const_reverse_iterator m=log.message().rbegin();171 std::vector<size_t>::const_reverse_iterator r=log.revision().rbegin();172 assert(log.author().size()==log.date().size());173 assert(log.author().size()==log.message().size());174 assert(log.author().size()==log.revision().size());175 168 os << "<tr><td>Author</td><td>Date</td><td>Rev</td><td>Added</td>" 176 169 << "<td>Removed</td><td>Message</td></tr>\n"; … … 179 172 const size_t maxlength = 80; 180 173 const Configuration& conf = Configuration::instance(); 181 for (size_t i=0; i<10 && a!=log.author().rend(); ++i) { 174 typedef std::vector<Commitment>::const_reverse_iterator iter; 175 for (iter i=log.commits().rbegin(); 176 i < std::min(i+10,log.commits().rend()); ++i) { 182 177 os << "<tr><td>" 183 << anchor(std::string("classic/")+*a+"/total/index.html",*a) 178 << anchor(std::string("classic/")+i->author()+"/total/index.html", 179 i->author()) 184 180 << "</td>"; 185 Date date( *d);181 Date date(i->date()); 186 182 os << "<td>" << date(timefmt) << "</td>"; 187 183 os << "<td>"; 188 os << trac_revision( *r);184 os << trac_revision(i->revision()); 189 185 os << "</td>"; 190 186 os << "<td>"; 191 int added = stats["add"](LineTypeParser::total, "all", *r) -192 stats["add"](LineTypeParser::total, "all", *r- 1);187 int added = stats["add"](LineTypeParser::total, "all", i->revision()) - 188 stats["add"](LineTypeParser::total, "all", i->revision() - 1); 193 189 os << added; 194 190 os << "</td>"; 195 191 os << "<td>"; 196 os << added - (stats["blame"](LineTypeParser::total, "all", *r) -197 stats["blame"](LineTypeParser::total, "all", *r -1));192 os << added-(stats["blame"](LineTypeParser::total, "all", i->revision()) - 193 stats["blame"](LineTypeParser::total,"all",i->revision()-1)); 198 194 os << "</td>"; 199 195 os << "<td>"; 200 std::string mess = *m;196 std::string mess = i->message(); 201 197 // replace newlines with space 202 198 std::replace(mess.begin(), mess.end(), '\n', ' '); … … 215 211 216 212 os << "</td></tr>\n"; 217 ++a;218 ++d;219 ++m;220 ++r;221 213 } 222 214 os << "</table></div>\n"; -
branches/replacing_gnuplot/lib/html_utility.cc
r589 r646 25 25 #include "html_utility.h" 26 26 27 #include "config.h" 27 28 #include "Configuration.h" 28 29 #include "Date.h" … … 69 70 PACKAGE_STRING, 0, ""); 70 71 if (DEV_BUILD) 71 os << " ( r" << svn_revision() << ")";72 os << " (dev build r" << svn_revision() << ")"; 72 73 os << "\n</p>\n</div>\n</body>\n</html>\n"; 73 74 } … … 181 182 182 183 183 std::string trac_revision(s ize_t r, std::string color)184 std::string trac_revision(svn_revnum_t r, std::string color) 184 185 { 185 186 const Configuration& conf = Configuration::instance(); -
branches/replacing_gnuplot/lib/html_utility.h
r589 r646 30 30 #include <string> 31 31 #include <vector> 32 33 #include <subversion-1/svn_types.h> 32 34 33 35 namespace theplu{ … … 71 73 /// given otherwise just a string corresponding to passed parameter. 72 74 /// 73 std::string trac_revision(s ize_t, std::string color="");75 std::string trac_revision(svn_revnum_t, std::string color=""); 74 76 75 77 }} // end of namespace svndigest end of namespace theplu -
branches/replacing_gnuplot/lib/subversion_info.cc.in
r581 r646 28 28 namespace svndigest{ 29 29 30 std::string compilation_date(void) 31 { 32 return __DATE__; 33 } 34 35 36 std::string compilation_time(void) 37 { 38 return __TIME__; 39 } 40 41 30 42 std::string svn_revision(void) 31 43 { -
branches/replacing_gnuplot/lib/subversion_info.h
r569 r646 30 30 namespace svndigest{ 31 31 32 // These functions are (mis)placed here to reflect compilation time 33 // of subversion_info.cc. Previously, __TIME__ macro was placed in 34 // `bin/Parameter.cc' and since the Parameter is almost independent 35 // of other parts of the package, that compilation time does not 36 // very accurately reflect the building time of the svndigest 37 // binary. subversion_info.cc is at least modified when updating 38 // against repository and therefore these functions will return a 39 // time no earlier than last `svn update' 40 std::string compilation_date(void); 41 std::string compilation_time(void); 42 32 43 std::string svn_revision(void); 33 44 -
branches/replacing_gnuplot/lib/utility.cc
r589 r646 23 23 24 24 #include "utility.h" 25 26 #include "subversion_info.h" 27 #include "config.h" 25 28 26 29 #include <cassert> … … 321 324 322 325 326 std::string version_string(void) 327 { 328 std::stringstream ss; 329 ss << " ("; 330 if (DEV_BUILD) 331 ss << "r" << svn_revision() << " "; 332 ss << "compiled " << compilation_time() << ", " << compilation_date() 333 << ")"; 334 return ss.str(); 335 } 336 337 323 338 std::string match(std::string::const_iterator& first, 324 339 const std::string::const_iterator& last, -
branches/replacing_gnuplot/lib/utility.h
r589 r646 200 200 inline std::string trim(std::string str) { return htrim(ltrim(str)); } 201 201 202 /// 203 /// \return string with version info 204 /// 205 std::string version_string(void); 206 202 207 203 208 template <typename T> -
branches/replacing_gnuplot/test/Makefile.am
r607 r646 23 23 # 02111-1307, USA. 24 24 25 check_PROGRAMS = config_test date gnuplot_pipe\26 parser tracutility_test25 check_PROGRAMS = config_test date_test gnuplot_pipe_test \ 26 parser_test trac_test utility_test 27 27 28 28 # these tests are only for developers since we do not distribute test repository 29 29 if HAVE_SVN_WC 30 check_PROGRAMS += copyright stats_test30 check_PROGRAMS += copyright_test stats_test 31 31 endif 32 32 … … 45 45 46 46 47 LDADD = $(STATICFLAG) @builddir@/libsvndigesttest.la \ 48 @top_builddir@/lib/libsvndigest.la 47 LDADD = @builddir@/libsvndigesttest.la \ 48 @top_builddir@/lib/libsvndigest.la \ 49 $(SVNDIGEST_LIBS) 50 AM_LDFLAGS = $(STATICFLAG) $(SVNDIGEST_LDFLAGS) 49 51 50 AM_CPPFLAGS = -I@top_srcdir@/lib 52 AM_CPPFLAGS = -I@top_srcdir@/lib $(SVNDIGEST_CPPFLAGS) 53 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 51 54 52 55 libsvndigesttest_la_SOURCES = Suite.cc 53 56 54 57 config_test_SOURCES = config_test.cc 55 copyright_ SOURCES = copyright.cc56 date_ SOURCES = date.cc57 gnuplot_pipe_ SOURCES = gnuplot_pipe.cc58 parser_ SOURCES = parser.cc58 copyright_test_SOURCES = copyright_test.cc 59 date_test_SOURCES = date_test.cc 60 gnuplot_pipe_test_SOURCES = gnuplot_pipe_test.cc 61 parser_test_SOURCES = parser_test.cc 59 62 stats_test_SOURCES = stats_test.cc 60 trac_ SOURCES = trac.cc63 trac_test_SOURCES = trac_test.cc 61 64 utility_test_SOURCES = utility_test.cc 62 65 … … 69 72 # some tests need the test repo to be checked out 70 73 stats_test_DEPENDENCIES = $(toy_project) @top_builddir@/lib/libsvndigest.la 71 copyright_DEPENDENCIES = $(toy_project) @top_builddir@/lib/libsvndigest.la 74 copyright_test_DEPENDENCIES = $(toy_project) @top_builddir@/lib/libsvndigest.la 75 76 @top_builddir@/lib/libsvndigest.la: 77 @cd @top_builddir@/lib/ && $(MAKE) $(AM_MAKEFLAGS); 72 78 73 79 $(toy_project): … … 76 82 77 83 clean-local: 78 rm -rf *.png *.tmp *~ check_repo_status.sh test_repo.sh \ 79 $(targetdir) 84 rm -rf *.png *.tmp *~ $(targetdir) 85 86 .PHONY: @top_builddir@/lib/libsvndigest.la
Note: See TracChangeset
for help on using the changeset viewer.