Changeset 845 for branches/replacing_gnuplot
- Timestamp:
- Nov 16, 2009, 11:27:19 PM (14 years ago)
- Location:
- branches/replacing_gnuplot
- Files:
-
- 12 deleted
- 46 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/replacing_gnuplot/ChangeLog
r784 r845 1 1 $Id$ 2 2 3 The change history is available online. To see the change log, direct 4 your favorite web browser to: 5 6 http://dev.thep.lu.se/svndigest/log or 7 8 http://dev.thep.lu.se/svndigest/log?format=changelog 9 10 for a more traditional ChangeLog look. 11 12 For the log at a specific release, direct your browser to 13 14 http://dev.thep.lu.se/svndigest/log/tags/<VERSION>?mode=follow_copy or 15 16 http://dev.thep.lu.se/svndigest/log/tags/<VERSION>?mode=follow_copy&format=changelog 17 18 for a more traditional ChangeLog look. 19 20 The log is also available as RSS Feed suitable for subscription: 21 22 http://dev.thep.lu.se/svndigest/log?format=rss 23 24 25 ---------------------------------------------------------------------- 3 26 {{{ 4 27 Copyright (C) 2005, 2006 Jari Häkkinen … … 22 45 }}} 23 46 ---------------------------------------------------------------------- 24 25 Changes are tracked with subversion log messages, tracs presentation26 of the logs, and the tickets assigned to the different versions.27 28 version 0.7:29 - http://dev.thep.lu.se/svndigest/log/trunk?rev=HEAD&stop_rev=41830 - http://dev.thep.lu.se/svndigest/query?milestone=0.7&order=id31 32 version 0.6.7:33 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=765&stop_rev=68734 - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.7&order=id35 36 version 0.6.6:37 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=685&stop_rev=57738 - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.6&order=id39 40 version 0.6.5:41 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=575&stop_rev=49142 - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.5&order=id43 44 version 0.6.4:45 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=489&stop_rev=47446 - http://dev.thep.lu.se/svndigest/query?milestone=0.6.4&order=id47 48 version 0.6.3:49 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=472&stop_rev=46050 - http://dev.thep.lu.se/svndigest/query?milestone=0.6.3&order=id51 52 version 0.6.2:53 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=459&stop_rev=43854 - http://dev.thep.lu.se/svndigest/query?milestone=0.6.2&order=id55 56 version 0.6.1:57 - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=437&stop_rev=41758 - http://dev.thep.lu.se/svndigest/query?milestone=0.6.1&order=id59 60 version 0.6:61 - http://dev.thep.lu.se/svndigest/log/trunk?rev=413&stop_rev=19562 - http://dev.thep.lu.se/svndigest/query?milestone=0.6&order=id63 64 version 0.5:65 - http://dev.thep.lu.se/svndigest/log/trunk?rev=194&stop_rev=15166 - http://dev.thep.lu.se/svndigest/query?milestone=0.5&order=id67 68 version 0.4:69 - http://dev.thep.lu.se/svndigest/log/trunk?rev=150&stop_rev=14870 71 version 0.3:72 - http://dev.thep.lu.se/svndigest/log/trunk?rev=147&stop_rev=8373 - http://dev.thep.lu.se/svndigest/query?milestone=0.3&order=id74 75 version 0.1 and 0.2:76 - http://dev.thep.lu.se/svndigest/log/trunk?rev=82&stop_rev=177 - http://dev.thep.lu.se/svndigest/query?milestone=0.2&order=id78 - http://dev.thep.lu.se/svndigest/query?milestone=0.1&order=id -
branches/replacing_gnuplot/Makefile.am
r784 r845 22 22 23 23 # -I arg should be the same as arg in AC_CONFIG_MACRO_DIR in configure.ac 24 ACLOCAL_AMFLAGS = -I m4 --install24 ACLOCAL_AMFLAGS = -I m4 25 25 26 26 SUBDIRS = lib bin man test … … 33 33 if ENABLE_SVN_SUPPORT 34 34 include build_support/svn_support.am 35 else 36 release: 37 @echo "ERROR: target 'release' not activated." 38 @echo " You need to run configure with '--enable-svn-support'." 39 @exit 1 35 40 endif 36 41 -
branches/replacing_gnuplot/NEWS
r784 r845 11 11 A complete list of closed tickets can be found here [[br]] 12 12 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7 13 14 version 0.6.8 (released 12 November 2009) 15 - configure now handles --disable correctly (issue #383) 16 17 A complete list of closed tickets can be found here [[br]] 18 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=svndigest+0.6.8 13 19 14 20 version 0.6.7 (released 1 February 2009) -
branches/replacing_gnuplot/README
r786 r845 2 2 3 3 = About svndigest = 4 5 This directory contains the 0.7 release of svndigest.6 4 7 5 svndigest is a tool to extract development information and statistics … … 16 14 17 15 Directory `bin` contains main program and is location for svndigest 18 binary. Directory ` build_support` contains additional autotool macros16 binary. Directory `m4` contains additional autotool macros 19 17 required for creating the build environment. Directory `doc` contains 20 18 documentation mainly in file `readme.txt`. Most of the code can be … … 118 116 {{{ 119 117 Copyright (C) 2005, 2006 Jari Häkkinen 120 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson118 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 121 119 122 120 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/replacing_gnuplot/README.developer
r784 r845 96 96 97 97 98 === yat library === 99 100 Directory `lib/yat/` contains some files from the yat library. These 101 files are not owned by svndigest and should not (if possible) be 102 edited here. For more details please see `lib/yat/README`. 103 98 104 === Output file structure === 99 105 … … 109 115 StatsType. Images for different Authors are identical and therefore 110 116 shared between authors. 111 112 113 === Create a distribution ===114 115 Create a distribution package with `make dist`. Remember to test116 the package with `make distcheck`. If required packages are installed117 in non-standard locations you need to pass this information to118 `distcheck`. This is done by using the variable119 DISTCHECK_CONFIGURE_FLAGS as120 121 `DISTCHECK_CONFIGURE_FLAGS="[OPTION]..." make distcheck`122 123 Usually you need to set DISTCHECK_CONFIGURE_FLAGS to whatever options124 you pass to configure.125 117 126 118 -
branches/replacing_gnuplot/THANKS
r784 r845 8 8 implementation is available through http://ndevilla.free.fr/ . 9 9 10 svndigest build system uses an M4 macro ( build_support/find_apr.m4)11 created within the Apache project (The Apache Software Foundation). No 12 changes is made to the M4 script. The Apache license text is available 13 as build_support/apache_LICENSE-2.0.txt.10 svndigest build system uses an M4 macro (m4/find_apr.m4) created 11 within the Apache project (The Apache Software Foundation). No changes 12 is made to the M4 script. The Apache license text is available as 13 m4/apache_LICENSE-2.0.txt. 14 14 15 15 The cascading style sheet generated by svndigest was initially -
branches/replacing_gnuplot/bin/Makefile.am
r784 r845 29 29 noinst_HEADERS = Parameter.h 30 30 31 LDADD = $(top_builddir)/lib/libsvndigest.a $(SVNDIGEST_LIBS) 31 LDADD = $(top_builddir)/lib/libsvndigest.a \ 32 $(top_builddir)/lib/yat/libyat.a $(SVNDIGEST_LIBS) 32 33 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) 33 34 -
branches/replacing_gnuplot/bin/Parameter.cc
r784 r845 22 22 #include "Parameter.h" 23 23 24 #include "ColumnStream.h"25 #include "OptionArg.h"26 #include "OptionHelp.h"27 #include "OptionSwitch.h"28 24 #include "OptionVersion.h" 29 #include "utility.h" 25 #include "../lib/utility.h" // to avoid inclusion of yat file 26 27 #include "yat/ColumnStream.h" 28 #include "yat/Exception.h" 29 #include "yat/OptionArg.h" 30 #include "yat/OptionHelp.h" 31 #include "yat/OptionSwitch.h" 32 30 33 #include <config.h> // this header file is created by configure 31 34 … … 41 44 #include <sys/stat.h> 42 45 46 // FIXME: remove this when we require autoconf 2.64 47 // autoconf 2.64 defines PACKAGE_URL in config.h (from AC_INIT) 48 #ifndef PACKAGE_URL 49 #define PACKAGE_URL "http://dev.thep.lu.se/svndigest" 50 #endif 51 43 52 namespace theplu { 44 53 namespace svndigest { 45 54 46 55 Parameter::Parameter( int argc, char *argv[]) 47 : cmd_( 48 "Mandatory arguments to long options are mandatory for short options too.") 56 : cmd_( std::string("Mandatory arguments to long options ") + 57 std::string("are mandatory for short options too.")), 58 config_file_(cmd_, "config-file", 59 "configuration file [<ROOT>/.svndigest/config]"), 60 copyright_(cmd_, "copyright", "update copyright statement"), 61 force_(cmd_, "f,force", 62 std::string("if sub-directory named <ROOT> exists in target dire")+ 63 std::string("ctory, remove sub-directory before writing results")), 64 generate_config_(cmd_, "g,generate-config", 65 "write configuration to standard output"), 66 help_(cmd_), 67 ignore_cache_(cmd_, "ignore-cache", 68 std::string("ignore cache files and analyze ") + 69 std::string("everything from repository")), 70 report_(cmd_, "report", "create no HTML report", true), 71 revisions_(cmd_, "revisions", 72 "use revision number as time scale instead of dates [dates]"), 73 root_(cmd_, "r,root", 74 "svn controlled directory to perform statistics on [.]"), 75 target_(cmd_, "t,target", "output directory [.]"), 76 verbose_(cmd_, "v,verbose", "explain what is being done"), 77 version_(cmd_, "version", "print version information and exit", &verbose_) 49 78 { 50 79 init(); … … 52 81 cmd_.parse(argc, argv); 53 82 } 54 catch ( cmd_error& e) {83 catch (yat::utility::cmd_error& e) { 55 84 std::cerr << e.what() << std::endl; 56 85 exit (-1); … … 58 87 59 88 // set default values 60 if (!root_ ->present())61 root_ ->value(".");62 63 if (!target_ ->present())64 target_ ->value(".");65 66 if (!config_file_ ->present())67 config_file_ ->value(concatenate_path(root_->value(),".svndigest/config"));89 if (!root_.present()) 90 root_.value("."); 91 92 if (!target_.present()) 93 target_.value("."); 94 95 if (!config_file_.present()) 96 config_file_.value(concatenate_path(root_.value(),".svndigest/config")); 68 97 69 98 // analyse arguments … … 74 103 Parameter::~Parameter(void) 75 104 { 76 delete config_file_;77 delete copyright_;78 delete force_;79 delete generate_config_;80 delete help_;81 delete ignore_cache_;82 delete report_;83 delete revisions_;84 delete root_;85 delete target_;86 delete verbose_;87 delete version_;88 105 } 89 106 … … 95 112 // check root but not if -g option given 96 113 if (!generate_config()) { 97 check_existence(root_ ->value());98 check_readable(root_ ->value());99 if (chdir(root_ ->value().c_str())) {114 check_existence(root_.value()); 115 check_readable(root_.value()); 116 if (chdir(root_.value().c_str())) { 100 117 std::stringstream ss; 101 ss << "svndigest: cannot read `" << root_ ->value() << "': "118 ss << "svndigest: cannot read `" << root_.value() << "': " 102 119 << strerror(errno); 103 throw cmd_error(ss.str());120 throw yat::utility::cmd_error(ss.str()); 104 121 } 105 root_ ->value(pwd());122 root_.value(pwd()); 106 123 chdir(save_wd.c_str()); 107 124 108 125 // check target (only if we write report) 109 126 if (report()) { 110 check_existence(target_ ->value());111 check_readable(target_ ->value());112 std::string base_root = file_name(root_ ->value());113 std::string path = concatenate_path(target_ ->value(),base_root);114 if (access_rights(target_ ->value().c_str(), "w")) {127 check_existence(target_.value()); 128 check_readable(target_.value()); 129 std::string base_root = file_name(root_.value()); 130 std::string path = concatenate_path(target_.value(),base_root); 131 if (access_rights(target_.value().c_str(), "w")) { 115 132 std::stringstream ss; 116 133 ss << "svndigest: cannot create directory `" << path 117 134 << "': " << strerror(errno); 118 throw cmd_error(ss.str());135 throw yat::utility::cmd_error(ss.str()); 119 136 } 120 137 if (node_exist(path) && !force()) { … … 122 139 ss << "svndigest: cannot create directory `" << path << "' " 123 140 << strerror(EEXIST); 124 throw cmd_error(ss.str());141 throw yat::utility::cmd_error(ss.str()); 125 142 } 126 if (chdir(target_ ->value().c_str())) {143 if (chdir(target_.value().c_str())) { 127 144 std::stringstream ss; 128 ss << "svndigest: cannot read `" << target_ ->value() << "': "145 ss << "svndigest: cannot read `" << target_.value() << "': " 129 146 << strerror(errno); 130 throw cmd_error(ss.str());147 throw yat::utility::cmd_error(ss.str()); 131 148 } 132 target_ ->value(pwd());149 target_.value(pwd()); 133 150 chdir(save_wd.c_str()); 134 151 } … … 138 155 struct stat nodestat; 139 156 // true also if there is a broken symlink named... 140 bool config_exists = !lstat(config_file_ ->value().c_str(), &nodestat);157 bool config_exists = !lstat(config_file_.value().c_str(), &nodestat); 141 158 // the latter case in order to catch broken symlink 142 if (config_file_ ->present() || config_exists)159 if (config_file_.present() || config_exists) 143 160 // throws if file does not exists 144 check_existence(config_file_ ->value());161 check_existence(config_file_.value()); 145 162 if (config_exists) { 146 163 // throws if file is not readable 147 check_readable(config_file_ ->value());148 stat(config_file_ ->value().c_str(), &nodestat);164 check_readable(config_file_.value()); 165 stat(config_file_.value().c_str(), &nodestat); 149 166 if (!S_ISREG(nodestat.st_mode)) { 150 167 std::stringstream ss; 151 ss << "svndigest: `" << config_file_ ->value()168 ss << "svndigest: `" << config_file_.value() 152 169 << "' is not a regular file"; 153 throw cmd_error(ss.str());170 throw yat::utility::cmd_error(ss.str()); 154 171 } 155 172 } … … 163 180 std::stringstream ss; 164 181 ss << "svndigest: cannot stat `" << path << "': " << strerror(errno); 165 throw cmd_error(ss.str());182 throw yat::utility::cmd_error(ss.str()); 166 183 } 167 184 … … 173 190 std::stringstream ss; 174 191 ss << "svndigest: cannot open `" << path << "': " << strerror(errno); 175 throw cmd_error(ss.str());192 throw yat::utility::cmd_error(ss.str()); 176 193 } 177 194 … … 179 196 std::string Parameter::config_file(void) const 180 197 { 181 return config_file_ ->value();198 return config_file_.value(); 182 199 } 183 200 … … 185 202 bool Parameter::copyright(void) const 186 203 { 187 return copyright_ ->present();204 return copyright_.present(); 188 205 } 189 206 … … 191 208 bool Parameter::force(void) const 192 209 { 193 return force_ ->present();210 return force_.present(); 194 211 } 195 212 … … 197 214 bool Parameter::generate_config(void) const 198 215 { 199 return generate_config_ ->present();216 return generate_config_.present(); 200 217 } 201 218 … … 203 220 bool Parameter::ignore_cache(void) const 204 221 { 205 return ignore_cache_ ->present();222 return ignore_cache_.present(); 206 223 } 207 224 … … 211 228 // don't use argv[0] because user may rename the binary 212 229 cmd_.program_name() = PACKAGE_NAME; 213 config_file_ =new OptionArg<std::string>(cmd_, "config-file",214 "configuration file [<ROOT>/.svndigest/config]");215 config_file_->print_arg("=FILE");230 config_file_.print_arg("=FILE"); 231 root_.print_arg("=ROOT"); 232 target_.print_arg("=TARGET"); 216 233 std::stringstream ss; 217 copyright_ = new OptionSwitch(cmd_, "copyright", 218 "update copyright statement"); 219 220 ss << "if sub-directory named <ROOT> exists in target directory, remove " 221 << "sub-directory before writing results"; 222 force_ = new OptionSwitch(cmd_, "f,force", ss.str()); 223 ss.str(""); 224 225 help_ = new OptionHelp(cmd_); 226 generate_config_ = 227 new OptionSwitch(cmd_, "g,generate-config", 228 "write configuration file to standard output"); 229 230 ss.str(""); 231 ss << "ignore cache files and analyze everything from repository"; 232 ignore_cache_ = new OptionSwitch(cmd_, "ignore-cache", ss.str()); 233 234 report_ = new OptionSwitch(cmd_, "report", "create no HTML report", true); 235 236 ss.str(""); 237 ss << "use revision numbers as time scale instead of dates [dates]"; 238 revisions_ = new OptionSwitch(cmd_, "revisions", ss.str()); 239 240 root_= 241 new OptionArg<std::string>(cmd_, "r,root", 242 "svn controlled directory to perform statistics on [.]"); 243 root_->print_arg("=ROOT"); 244 target_ = new OptionArg<std::string>(cmd_, "t,target", 245 "output directory [.]"); 246 target_->print_arg("=TARGET"); 247 248 verbose_ = new OptionSwitch(cmd_, "v,verbose", "explain what is being done"); 249 version_ = new OptionVersion(cmd_, "version", 250 "print version information and exit", verbose_); 251 252 ss.str(""); 253 ss << "Report bugs to " << PACKAGE_BUGREPORT << ".\n"; 254 help_->post_arguments() = ss.str(); 255 help_->synopsis() = 234 ss << "Report bugs to " << PACKAGE_BUGREPORT << ".\n" 235 << PACKAGE << " home page: <" << PACKAGE_URL << ">.\n"; 236 help_.post_arguments() = ss.str(); 237 help_.synopsis() = 256 238 "Generate statistical report for a subversion repository\n"; 257 239 } … … 260 242 bool Parameter::report(void) const 261 243 { 262 return report_ ->value();244 return report_.value(); 263 245 } 264 246 … … 266 248 bool Parameter::revisions(void) const 267 249 { 268 return revisions_ ->present();250 return revisions_.present(); 269 251 } 270 252 … … 272 254 std::string Parameter::root(void) const 273 255 { 274 return root_ ->value();256 return root_.value(); 275 257 } 276 258 … … 278 260 std::string Parameter::targetdir(void) const 279 261 { 280 return target_ ->value();262 return target_.value(); 281 263 } 282 264 … … 284 266 bool Parameter::verbose(void) const 285 267 { 286 return verbose_ ->present();268 return verbose_.present(); 287 269 } 288 270 -
branches/replacing_gnuplot/bin/Parameter.h
r784 r845 24 24 */ 25 25 26 #include "CommandLine.h" 27 #include "OptionArg.h" 26 #include "OptionVersion.h" 27 28 #include "yat/CommandLine.h" 29 #include "yat/OptionArg.h" 30 #include "yat/OptionHelp.h" 31 #include "yat/OptionSwitch.h" 32 28 33 29 34 #include <string> 30 35 31 36 namespace theplu { 37 namespace yat { 38 namespace utility { 39 class OptionHelp; 40 class OptionSwitch; 41 }} 32 42 namespace svndigest { 33 43 34 class OptionHelp;35 class OptionSwitch;36 44 class OptionVersion; 37 45 … … 66 74 void init(void); 67 75 68 CommandLine cmd_;69 OptionArg<std::string>*config_file_;70 OptionSwitch*copyright_;71 OptionSwitch*force_;72 OptionSwitch*generate_config_;73 OptionHelp*help_;74 OptionSwitch*ignore_cache_;75 OptionSwitch*report_;76 OptionSwitch*revisions_;77 OptionArg<std::string>*root_;78 OptionArg<std::string>*target_;79 OptionSwitch*verbose_;80 OptionVersion *version_;76 yat::utility::CommandLine cmd_; 77 yat::utility::OptionArg<std::string> config_file_; 78 yat::utility::OptionSwitch copyright_; 79 yat::utility::OptionSwitch force_; 80 yat::utility::OptionSwitch generate_config_; 81 yat::utility::OptionHelp help_; 82 yat::utility::OptionSwitch ignore_cache_; 83 yat::utility::OptionSwitch report_; 84 yat::utility::OptionSwitch revisions_; 85 yat::utility::OptionArg<std::string> root_; 86 yat::utility::OptionArg<std::string> target_; 87 yat::utility::OptionSwitch verbose_; 88 OptionVersion version_; 81 89 82 90 }; -
branches/replacing_gnuplot/bin/svndigest.cc
r784 r845 26 26 #include "css.h" 27 27 #include "Directory.h" 28 #include "Exception.h"29 28 #include "first_page.h" 30 29 #include "GnuplotFE.h" … … 36 35 #include "SVNinfo.h" 37 36 #include "SVNlog.h" 38 #include "utility.h" 37 #include "../lib/utility.h" 38 39 #include "yat/Exception.h" 39 40 40 41 #include <cassert> … … 51 52 int main( int argc, char* argv[]) 52 53 { 53 using namespace theplu::svndigest; 54 using namespace theplu; 55 using namespace svndigest; 54 56 55 57 // Reading commandline options … … 60 62 std::cout << "Done parsing parameters" << std::endl; 61 63 } 62 catch ( cmd_error& e) {64 catch (yat::utility::cmd_error& e) { 63 65 std::cerr << e.what() << std::endl; 64 66 exit(-1); … … 158 160 std::cout << "Removing old target tree: " << target_path << "\n"; 159 161 rmdirhier(target_path); 160 } 162 // exit if remove failed 163 if (node_exist(target_path)) { 164 std::cerr << "svndigest: remove failed\n"; 165 exit(-1); 166 } 167 } 168 161 169 162 170 if (option->verbose()) -
branches/replacing_gnuplot/build_support/move-if-change
r646 r845 3 3 # Status is zero if successful, nonzero otherwise. 4 4 5 usage="$0: usage: $0 SOURCE DEST" 5 usage="$0: usage: $0 [-v] SOURCE DEST" 6 7 if test "x$1" = "x-v"; then 8 verbose=yes 9 shift 10 fi 6 11 7 12 case $# in … … 19 24 rm -f "$1" 20 25 else 26 if test "x$verbose" = "xyes"; then 27 echo "updating file $2" 28 fi 21 29 mv -f "$1" "$2" 22 30 fi -
branches/replacing_gnuplot/configure.ac
r786 r845 32 32 33 33 m4_include([m4/version.m4]) 34 AC_INIT([svndigest],[SVNDIGEST_VERSION],[jari@thep.lu.se]) 34 AC_INIT([svndigest],[SVNDIGEST_VERSION],[jari@thep.lu.se],, 35 [http://dev.thep.lu.se/svndigest]) 35 36 AC_CONFIG_SRCDIR([lib/File.h]) 36 37 AC_CONFIG_AUX_DIR([autotools]) … … 99 100 100 101 AC_ARG_ENABLE([debug], 101 [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], 102 [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) 103 104 AS_IF([test x$enable_debug = xyes], 102 105 [YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-g -O])], 103 106 [YAT_CPP_ADD_FLAG([SD_CPPFLAGS],[-DNDEBUG]) … … 109 112 [enable svn support - used by maintainer])]) 110 113 111 AS_IF([test "x$enable_svn -support" = xyes],112 [A C_CHECK_FILE([$srcdir/.svn],,113 114 AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn -support" = "xyes"])114 AS_IF([test "x$enable_svn_support" = xyes], 115 [AS_IF([test -d $srcdir/.svn], [], 116 [AC_MSG_ERROR([svn support cannot be enabled: `$srcdir' is not an svn wc.])])]) 117 AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn_support" = "xyes"]) 115 118 116 119 # Apache Portable Runtime (APR) API checks … … 135 138 [ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval" 136 139 YAT_LD_ADD_FLAG([SD_LDFLAGS], [-L$withval/lib]) 137 YAT_CPP_ADD_FLAG([SD_CPPFLAGS], [- L$withval/include])140 YAT_CPP_ADD_FLAG([SD_CPPFLAGS], [-I$withval/include]) 138 141 ]) 139 142 … … 185 188 186 189 # checking if we build in a subversion WC 187 A C_CHECK_FILE([$srcdir/.svn], [wc_found="yes"], [wc_found="no"])190 AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"]) 188 191 AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"]) 189 192 AC_SUBST([wc_found]) … … 191 194 # checking if we have test repo 192 195 test_repo_filename=$srcdir/test/repo; 193 A C_CHECK_FILE([$test_repo_filename],196 AS_IF([test -r $test_repo_filename], 194 197 [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available]) 195 198 test_repo_found="yes"], … … 209 212 bin/Makefile 210 213 lib/Makefile 214 lib/yat/Makefile 211 215 man/Makefile 212 216 test/environment.h 213 217 test/Makefile]) 218 219 AC_CONFIG_HEADER([lib/yat/config_public.h]) 214 220 215 221 # Print failure status information about selected items, and exit if -
branches/replacing_gnuplot/doc/readme.txt
r784 r845 1 1 $Id$ 2 {{{ 3 Copyright (C) 2005 Jari Häkkinen 4 Copyright (C) 2006 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2007, 2008, 2009 Peter Johansson 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest 8 9 svndigest is free software; you can redistribute it and/or modify it 10 under the terms of the GNU General Public License as published by the 11 Free Software Foundation; either version 3 of the License, or (at your 12 option) any later version. 13 14 svndigest is distributed in the hope that it will be useful, but 15 WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with svndigest. If not, see <http://www.gnu.org/licenses/>. 21 }}} 22 2 23 3 24 = About svndigest = … … 71 92 that there is only one such a rule in use, namely the one described 72 93 above that trailing `.in` in file names are discarded. 94 95 96 == Caching Statistics == 97 98 To avoid retrieving the same data repeatedly from the repository, 99 statistics is cahed in files located in `.svndigest`. Subsequent 100 svndigest runs read the cache files and retrieve information from the 101 repository only for the revisions that have been committed since the 102 cache file was created. Obviously, it is important that the cache 103 files reflect the history of the current working copy. If that is not 104 the case, for example, if you have switched working copy using `svn 105 switch`, you can make svndigest ignore the cache through option 106 `--ignore-cache`. 73 107 74 108 … … 164 198 * Create the plots and HTML presentation. 165 199 166 ----------------------------------------------------------------------167 {{{168 Copyright (C) 2005 Jari Häkkinen169 Copyright (C) 2006 Jari Häkkinen, Peter Johansson170 Copyright (C) 2007, 2008 Peter Johansson171 172 This file is part of svndigest, http://dev.thep.lu.se/svndigest173 174 svndigest is free software; you can redistribute it and/or modify it175 under the terms of the GNU General Public License as published by the176 Free Software Foundation; either version 3 of the License, or (at your177 option) any later version.178 179 svndigest is distributed in the hope that it will be useful, but180 WITHOUT ANY WARRANTY; without even the implied warranty of181 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU182 General Public License for more details.183 184 You should have received a copy of the GNU General Public License185 along with svndigest. If not, see <http://www.gnu.org/licenses/>.186 }}} -
branches/replacing_gnuplot/lib/AddStats.cc
r784 r845 2 2 3 3 /* 4 Copyright (C) 2008 Peter Johansson4 Copyright (C) 2008, 2009 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 33 33 #include <string> 34 34 #include <vector> 35 36 //debug37 #include <iostream>38 35 39 36 namespace theplu{ … … 69 66 if (*rev_iter==svn_blame.revision()) 70 67 add(svn_blame.author(), *rev_iter, lt); 71 // I dont trust blame and log behave consistent (stop-on-copy).68 // I dont trust blame and log behave consistently (stop-on-copy). 72 69 revs.insert(svn_blame.revision()); 73 70 svn_blame.next_line(); -
branches/replacing_gnuplot/lib/BlameStats.cc
r784 r845 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009 Peter Johansson 6 7 7 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 63 64 void BlameStats::fill_in(Author2Vector& a2v, svn_revnum_t rev) 64 65 { 65 assert(rev); 66 if (rev==0) 67 return; 66 68 for (std::set<std::string>::const_iterator iter(authors().begin()); 67 69 iter!=authors().end(); ++iter) { … … 94 96 } 95 97 96 // filling in pristine revisions 98 // filling in pristine revisions, i.e., revs that are larger than 99 // first_rev and not occuring in revs. 97 100 RevSet::iterator rev_iter=revs.begin(); 98 for (svn_revnum_t rev = first_rev+1; rev<=revision(); ++rev){ 99 if (rev==*rev_iter) 101 svn_revnum_t rev = first_rev; 102 while (rev<=revision()) { 103 if (rev_iter!=revs.end() && rev>*rev_iter) 100 104 ++rev_iter; 105 else if (rev_iter!=revs.end() && rev==*rev_iter) { 106 ++rev_iter; 107 ++rev; 108 } 101 109 else { 102 110 fill_in(code_stats(),rev); … … 104 112 fill_in(other_stats(),rev); 105 113 fill_in(copyright_stats(),rev); 114 ++rev; 106 115 } 107 116 } -
branches/replacing_gnuplot/lib/ClassicStats.cc
r784 r845 61 61 void ClassicStats::do_parse(const std::string& path, svn_revnum_t rev) 62 62 { 63 reset(); 63 64 LineTypeParser parser(path); 64 65 SVNblame svn_blame(path); 65 66 while (svn_blame.valid()) { 66 if (svn_blame.revision()>=rev) { 67 add(svn_blame.author(), svn_blame.revision(), 68 parser.parse(svn_blame.line())); 69 } 67 add(svn_blame.author(), svn_blame.revision(), 68 parser.parse(svn_blame.line())); 70 69 svn_blame.next_line(); 71 70 } 72 accumulate_stats( rev);71 accumulate_stats(); 73 72 } 74 73 -
branches/replacing_gnuplot/lib/Configuration.cc
r784 r845 58 58 else 59 59 iter->second.push_back(p); 60 } 61 62 63 std::string Configuration::author_str_color(const std::string& author) const 64 { 65 std::string res; 66 std::map<std::string, std::string>::const_iterator iterator; 67 if ( (iterator=author_color_.find(author)) != author_color_.end()) 68 res = iterator->second; 69 return res; 60 70 } 61 71 … … 177 187 } 178 188 } 189 else if (section == "author-color") { 190 author_color_[lhs] = rhs; 191 } 179 192 else if (section == "parsing-codons") { 180 193 if (!parsing_found) { … … 454 467 455 468 os << "\n" 469 << "### Section for author color in blame output\n" 470 << "[author-color]\n" 471 << "# jdoe = 000000\n"; 472 typedef std::map<std::string,std::string> str_map; 473 for (str_map::const_iterator i(conf.author_color_.begin()); 474 i!=conf.author_color_.end(); ++i) { 475 os << i->first << " = " << i->second << " \n"; 476 } 477 478 os << "\n" 456 479 << "### Section for setting trac environment\n" 457 480 << "[trac]\n" -
branches/replacing_gnuplot/lib/Configuration.h
r784 r845 43 43 public: 44 44 static Configuration& instance(void); 45 46 /** 47 \return hexadecimal color code (e.g. 5aee4a) that is used in 48 blame output. If no color is configured for \a author, an empty 49 string is returned. 50 */ 51 std::string author_str_color(const std::string& author) const; 45 52 46 53 /** … … 117 124 static Configuration* instance_; 118 125 126 std::map<std::string, std::string> author_color_; 119 127 std::map<std::string, Alias> copyright_alias_; 120 128 -
branches/replacing_gnuplot/lib/Directory.cc
r784 r845 109 109 110 110 111 svn_revnum_t Directory::last_changed_rev(void) const 112 { 113 svn_revnum_t res = svn_info().last_changed_rev(); 114 for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i) 115 res = std::max(res, (*i)->last_changed_rev()); 116 return res; 117 } 118 119 111 120 void Directory::log_core(SVNlog& log) const 112 121 { … … 140 149 { 141 150 mkdir("blame_output/" + local_path_); 142 // print daughter nodes , i.e., this function is recursive151 // print daughter nodes 143 152 for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i) 144 153 (*i)->print(verbose); … … 240 249 os << "</td>\n"; 241 250 } 242 os << "<td>" << trac_revision( stats.last_changed_rev()) << "</td>\n";251 os << "<td>" << trac_revision(last_changed_rev()) << "</td>\n"; 243 252 os << "<td>" << author() << "</td>\n"; 244 253 os << "</tr>\n"; … … 254 263 void Directory::print_copyright(std::map<std::string, Alias>& alias, 255 264 bool verbose, 256 const std::map<int,svn_revnum_t>& y2r) const { 265 const std::map<int,svn_revnum_t>& y2r) const 266 { 257 267 if (!ignore()){ 258 268 // print daughter nodes, i.e, this function is recursive -
branches/replacing_gnuplot/lib/Directory.h
r784 r845 71 71 72 72 /** 73 \brief Get the revision number of the latest commit. 74 75 Does not only check this directory but also daughter nodes. 76 */ 77 svn_revnum_t last_changed_rev(void) const; 78 79 /** 73 80 @return The explicit string "directory", nothing else. 74 81 */ -
branches/replacing_gnuplot/lib/File.cc
r789 r845 2 2 3 3 /* 4 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 4 Copyright (C) 2005, 2006, 2007, 2009 Jari Häkkinen, Peter Johansson 6 5 7 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 174 173 175 174 175 svn_revnum_t File::last_changed_rev(void) const 176 { 177 return svn_info().last_changed_rev(); 178 } 179 180 176 181 void File::log_core(SVNlog&) const 177 182 { … … 222 227 { 223 228 os << "<br /><h3>" << local_path() << "</h3>"; 229 os << "<div class=\"blame_legend\">\n"; 230 os << "<dl>\n"; 231 os << "<dt class=\"code\"></dt><dd>Code</dd>\n"; 232 os << "<dt class=\"comment\"></dt><dd>Comments</dd>\n"; 233 os << "<dt class=\"other\"></dt><dd>Other</dd>\n"; 234 os << "</dl>\n</div>\n"; 224 235 os << "<table class=\"blame\">\n"; 225 236 os << "<thead>\n"; … … 275 286 hs << Date(blame.date())("%d %b %y"); 276 287 os << "</font></td>\n<td class=\"author\">"; 288 std::string author_color = 289 Configuration::instance().author_str_color(blame.author()); 290 if (!author_color.empty()) 291 os << "<font color=\"#" << author_color << "\">"; 277 292 hs << blame.author(); 278 293 os << "</td>\n<td class=\""; … … 427 442 catch (std::runtime_error e) { 428 443 // catch exception, cleanup, and rethrow 429 std::cerr << " File::print_copyright: Exception caught, "444 std::cerr << "svndigest: File::print_copyright: Exception caught, " 430 445 << "removing temporary file " << tmpname << std::endl; 431 446 if (unlink(tmpname)) -
branches/replacing_gnuplot/lib/File.h
r784 r845 47 47 */ 48 48 std::string href(void) const; 49 50 /** 51 \brief Get the revision number of the latest commit. 52 */ 53 svn_revnum_t last_changed_rev(void) const; 49 54 50 55 /** -
branches/replacing_gnuplot/lib/LineTypeParser.h
r784 r845 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2007 Peter Johansson8 Copyright (C) 2007, 2009 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 43 43 public: 44 44 /// 45 /// see 'doc/readme a.txt' for info on what is code, comment, and other.45 /// see 'doc/readme.txt' for info on what is code, comment, and other. 46 46 /// 47 47 // do not change these without checking in Stats class -
branches/replacing_gnuplot/lib/Makefile.am
r788 r845 23 23 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 24 24 25 MOVE_IF_CHANGE = $(SHELL) $(top_srcdir)/build_support/move-if-change 26 SVN_REVISION = `$(SVNVERSION) $(top_srcdir)` 27 28 SUBDIRS = yat . 29 25 30 AM_CPPFLAGS = $(SVNDIGEST_CPPFLAGS) 26 31 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) … … 28 33 noinst_LIBRARIES = libsvndigest.a 29 34 30 noinst_HEADERS = AddStats.h Alias.h BlameStats.h ClassicStats.h ColumnStream.h\31 Comm andLine.h Commitment.h Configuration.h copyright_year.h css.h\32 Date.h Directory.h Exception.hFile.h first_page.h Functor.h \35 noinst_HEADERS = AddStats.h Alias.h BlameStats.h ClassicStats.h \ 36 Commitment.h Configuration.h copyright_year.h css.h\ 37 Date.h Directory.h File.h first_page.h Functor.h \ 33 38 Graph.h \ 34 39 HtmlBuf.h HtmlStream.h html_utility.h LineTypeParser.h \ 35 Node.h Option.h OptionArg.h OptionHelp.h OptionSwitch.h \40 Node.h 36 41 OptionVersion.h rmdirhier.h \ 37 42 Stats.h StatsCollection.h subversion_info.h SVN.h SVNblame.h \ … … 39 44 40 45 libsvndigest_a_SOURCES = AddStats.cc Alias.cc BlameStats.cc \ 41 ClassicStats.cc ColumnStream.cc\42 Comm andLine.cc Commitment.cc Configuration.cc copyright_year.cc \46 ClassicStats.cc \ 47 Commitment.cc Configuration.cc copyright_year.cc \ 43 48 css.cc Date.cc Directory.cc File.cc first_page.cc\ 44 49 Functor.cc Graph.cc HtmlBuf.cc HtmlStream.cc \ 45 50 html_utility.cc LineTypeParser.cc Node.cc \ 46 Option .cc OptionHelp.cc OptionSwitch.cc OptionVersion.cc \51 OptionVersion.cc \ 47 52 rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc \ 48 53 SVNblame.cc SVNinfo.cc SVNlog.cc SVNproperty.cc Trac.cc utility.cc … … 58 63 if HAVE_SVN_WC 59 64 $(srcdir)/subversion_info.cc: subversion_info.cc.tmp 60 @$(SHELL) $(top_srcdir)/build_support/move-if-change subversion_info.cc.tmp \ 61 $(srcdir)/subversion_info.cc 65 @$(MOVE_IF_CHANGE) subversion_info.cc.tmp $@ 62 66 63 67 subversion_info.cc.tmp: FORCE 64 68 @echo '// subversion_info.cc generated from subversion_info.cc.in.' > $@ ;\ 65 revision= `$(SVNVERSION) $(top_srcdir)`;\69 revision=$(SVN_REVISION);\ 66 70 $(SED) -e 's/sub_2_svn_revision/r'$$revision'/g' \ 67 71 $(srcdir)/subversion_info.cc.in >> $@ ; … … 69 73 # update copyright year automatically (if we build from svn wc) 70 74 $(srcdir)/copyright_year.cc: copyright_year.cc.tmp 71 @$( SHELL) $(top_srcdir)/build_support/move-if-change $<$@75 @$(MOVE_IF_CHANGE) copyright_year.cc.tmp $@ 72 76 73 77 copyright_year.cc.tmp: FORCE 74 @year=`svn info $(top_srcdir)|$(SED) -n 's/.*Date: \(.*\)-..-.*/\1/p'`;\ 75 $(SED) -e 's/"20[0-9][0-9]"/'\"$$year\"'/g' $(srcdir)/copyright_year.cc > $@ ; 78 @if (echo $(SVN_REVISION) | $(GREP) M); then \ 79 $(SED) -e 's/"20[0-9][0-9]"/'\"`date -u "+%Y"`\"'/g' \ 80 $(srcdir)/copyright_year.cc > $@ ; \ 81 else \ 82 cp $(srcdir)/copyright_year.cc $@; \ 83 fi 76 84 77 85 else -
branches/replacing_gnuplot/lib/Node.cc
r784 r845 31 31 #include "utility.h" 32 32 33 #include <algorithm> 33 34 #include <cassert> 34 35 #include <ctime> … … 137 138 << "<td>" << author() << "</td>\n" 138 139 << "</tr>\n"; 139 }140 141 142 svn_revnum_t Node::last_changed_rev(void) const143 {144 if (ignore())145 return svninfo_.last_changed_rev();146 assert(log().commits().size());147 return log().latest_commit().revision();148 140 } 149 141 … … 317 309 // map with last rev for every year 318 310 std::map<int, svn_revnum_t> year2rev; 319 SVNlog log(path()); 311 // get log for entire project 312 SVNlog log(SVNinfo(path()).repos_root_url()); 320 313 typedef SVNlog::container::const_iterator LogIterator; 321 314 for (LogIterator i=log.commits().begin(); i!=log.commits().end(); ++i){ 322 315 time_t sec = str2time(i->date()); 323 316 tm* timeinfo = gmtime(&sec); 324 year2rev[timeinfo->tm_year] = i->revision(); 317 // ignore commits in repository not present in wc 318 year2rev[timeinfo->tm_year] = std::min(i->revision(), last_changed_rev()); 325 319 } 326 320 print_copyright(alias, verbose, year2rev); -
branches/replacing_gnuplot/lib/Node.h
r784 r845 110 110 /// @brief Get the revision number of the latest commit. 111 111 /// 112 svn_revnum_t last_changed_rev(void) const;112 virtual svn_revnum_t last_changed_rev(void) const=0; 113 113 114 114 /** … … 204 204 /// 205 205 void path_anchor(std::ostream& os) const; 206 207 inline const SVNinfo& svn_info(void) const { return svninfo_; } 206 208 207 209 unsigned int level_; -
branches/replacing_gnuplot/lib/OptionVersion.cc
r784 r845 2 2 3 3 /* 4 Copyright (C) 2008 Peter Johansson4 Copyright (C) 2008, 2009 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 24 #include "copyright_year.h" 25 25 #include "OptionVersion.h" 26 #include "ColumnStream.h"27 #include "CommandLine.h"28 26 #include "subversion_info.h" 29 27 #include "utility.h" 28 29 #include "yat/ColumnStream.h" 30 #include "yat/CommandLine.h" 31 32 #include <subversion-1/svn_version.h> 33 34 #include <apr_version.h> 30 35 31 36 #include <sstream> … … 35 40 namespace svndigest { 36 41 37 OptionVersion::OptionVersion( CommandLine& cmd, std::string flag,42 OptionVersion::OptionVersion(yat::utility::CommandLine& cmd, std::string flag, 38 43 std::string desc, OptionSwitch* const verbose) 39 : OptionSwitch(cmd, flag, desc, false), verbose_(verbose)44 : yat::utility::OptionSwitch(cmd, flag, desc, false), verbose_(verbose) 40 45 { 41 46 } … … 45 50 std::vector<std::string>::iterator last) 46 51 { 47 ColumnStream cs(std::cout, 1);52 yat::utility::ColumnStream cs(std::cout, 1); 48 53 cs.width(0)=79; 49 54 cs << PACKAGE_NAME << " " << PACKAGE_VERSION; … … 62 67 << "<http://www.gnu.org/licenses/gpl.html>.\n" 63 68 << "There is NO WARRANTY; to the extent permitted by law.\n"; 69 if (!no_verbose) { 70 cs << "\n" 71 << "Compiled with libsvn_subr " << SVN_VER_NUM 72 << "; using libsvn_subr "; 73 const svn_version_t* svn_ver = svn_subr_version(); 74 cs << svn_ver->major << '.' << svn_ver->minor << '.' << svn_ver->patch; 75 cs << "\n" 76 << "Compiled with libapr " << APR_VERSION_STRING 77 << "; using libapr "; 78 cs << apr_version_string(); 79 cs << "\n"; 80 } 64 81 exit(0); 65 82 } -
branches/replacing_gnuplot/lib/OptionVersion.h
r784 r845 25 25 */ 26 26 27 #include " OptionSwitch.h"27 #include "yat/OptionSwitch.h" 28 28 29 29 #include <string> 30 30 31 31 namespace theplu { 32 namespace yat { 33 namespace utility { 34 class CommandLine; 35 }} 32 36 namespace svndigest { 33 37 34 class CommandLine;35 38 /** 36 39 \brief Class for version option … … 39 42 version output. 40 43 */ 41 class OptionVersion : public OptionSwitch44 class OptionVersion : public yat::utility::OptionSwitch 42 45 { 43 46 public: … … 50 53 \param desc string used in help display 51 54 */ 52 OptionVersion( CommandLine& cmd, std::string name="version",55 OptionVersion(yat::utility::CommandLine& cmd, std::string name="version", 53 56 std::string desc="print version information and exit", 54 57 OptionSwitch* const verbose=NULL); -
branches/replacing_gnuplot/lib/SVN.h
r784 r845 24 24 along with svndigest. If not, see <http://www.gnu.org/licenses/>. 25 25 */ 26 27 // Turning off warnings from using deprecated function, i.e., we are 28 // using subversion 1.4 29 #ifndef SVN_DEPRECATED 30 #define SVN_DEPRECATED 31 #endif 32 26 33 27 34 #include <map> -
branches/replacing_gnuplot/lib/SVNinfo.h
r784 r845 109 109 /// @see Subversion API documentation 110 110 /// 111 // The return type should be svn_log_message_receiver_t but I112 // cannot get it to compile (see comment for log_message_receiver113 // in SVNlog.h)114 111 static svn_error_t * info_receiver(void *baton, const char *path, 115 112 const svn_info_t *info, apr_pool_t *pool); -
branches/replacing_gnuplot/lib/SVNlog.h
r784 r845 126 126 \see Subversion API documentation 127 127 */ 128 // The return type should be svn_log_message_receiver_t but I129 // cannot get it to compile. The svn API has a typedef like130 // typedef svn_error_t*(* svn_log_message_receiver_t)(void *baton,131 // apr_hash_t *changed_paths, svn_revnum_t revision, const char132 // *author, const char *date,const char *message, apr_pool_t133 // *pool) for svn_log_message_receiver_t.134 128 static svn_error_t* 135 129 log_message_receiver(void *baton, apr_hash_t *changed_paths, -
branches/replacing_gnuplot/lib/Stats.cc
r784 r845 4 4 Copyright (C) 2005 Peter Johansson 5 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2008 Peter Johansson6 Copyright (C) 2008, 2009 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 118 118 vec.reserve(rev+1); 119 119 vec.resize(rev); 120 assert(vec.size()+1<vec.max_size()); 120 121 if (x) { 121 assert(vec.size()+1<vec.max_size());122 122 vec.push_back(n); 123 123 } 124 124 else { 125 assert(vec.size()+1<vec.max_size());126 125 vec.push_back(0); 127 126 } … … 154 153 { 155 154 std::vector<unsigned int> init(revision()+1); 156 code_stats()["all"]=std::accumulate(code_stats().begin(), 157 code_stats().end(), init, 158 PairValuePlus<std::string,unsigned int>()); 159 comment_stats()["all"]=std::accumulate(comment_stats().begin(), 160 comment_stats().end(), init, 161 PairValuePlus<std::string,unsigned int>()); 162 other_stats()["all"]=std::accumulate(other_stats().begin(), 163 other_stats().end(), init, 164 PairValuePlus<std::string,unsigned int>()); 165 copyright_stats()["all"]=std::accumulate(copyright_stats().begin(), 166 copyright_stats().end(), init, 167 PairValuePlus<std::string,unsigned int>()); 155 for (int lt=0; lt <= 4; ++lt) { 156 stats_[lt]["all"].clear(); 157 stats_[lt]["all"] = 158 std::accumulate(stats_[lt].begin(), 159 stats_[lt].end(), init, 160 PairValuePlus<std::string,unsigned int>()); 161 } 168 162 VectorPlus<unsigned int> vp; 169 163 comment_or_copy_stats()["all"] = … … 171 165 172 166 total_stats()["all"] = 173 vp(vp(code_stats()["all"], comment_or_copy_stats()["all"]), 174 167 vp(vp(code_stats()["all"], comment_or_copy_stats()["all"]), 168 other_stats()["all"]); 175 169 } 176 170 … … 339 333 void Stats::parse(const std::string& path, svn_revnum_t rev) 340 334 { 335 // reset stats to zero for [rev, inf) 336 for (size_t i=0; i<stats_.size(); ++i) 337 for (A2VIter iter=stats_[i].begin(); iter!=stats_[i].end(); ++iter) { 338 iter->second.resize(rev,0); 339 iter->second.resize(revision(),0); 340 } 341 341 do_parse(path, rev); 342 342 calc_comment_or_copy(); -
branches/replacing_gnuplot/lib/StatsCollection.cc
r784 r845 63 63 svn_revnum_t cache_rev = i->second->load_cache(is); 64 64 if (cache_rev < i->second->last_changed_rev()) { 65 cache_rev=0; // tmp hack to avoid partial cache66 65 result = false; 67 66 // reset if load cache failed -
branches/replacing_gnuplot/lib/StatsCollection.h
r784 r845 60 60 61 61 /** 62 reset everything63 62 */ 64 63 void print(std::ostream&); -
branches/replacing_gnuplot/lib/css.cc
r784 r845 195 195 s << "table.blame tbody td.date {text-align:right;padding-right:1.45em;}\n"; 196 196 s << "table.blame tbody td.rev { text-align: right; }\n"; 197 std::string bg_lt_code("cfcfff"); 198 std::string bg_lt_comment("e8e8ff"); 199 std::string bg_lt_other("ffffff"); 197 200 s << "table.blame tbody td.line-code { text-align: right; " 198 << "background: # cfcfff; }\n";201 << "background: #" << bg_lt_code << "; }\n"; 199 202 s << "table.blame tbody td.line-comment { text-align: right; " 200 << "background: # e8e8ff; }\n";203 << "background: #" << bg_lt_comment << "; }\n"; 201 204 s << "table.blame tbody td.line-other { text-align: right; " 202 << "background: # ffffff; }\n";205 << "background: #" << bg_lt_other << "; }\n"; 203 206 s << "table.blame tbody tr:hover { background: #eed; }\n"; 204 207 s << "table.blame tbody td a { display: block; }\n"; … … 245 248 246 249 s << ".sep { color: #666}\n"; 250 s << "div.blame_legend .code { background: #" << bg_lt_code << "; }\n" 251 << "div.blame_legend .comment { background: #" << bg_lt_comment << "; }\n" 252 << "div.blame_legend .other { background: #" << bg_lt_other << "; }\n" 253 << "div.blame_legend {\n" 254 << "float: left;\n" 255 << "font-size: 9px;\n" 256 << "margin: 1em 0;\n" 257 << "padding: .5em;\n" 258 << "} \n" 259 << "div.blame_legend dt {\n" 260 << "background: #fff;\n" 261 << "border: 1px solid #999;\n" 262 << "float: left;\n" 263 << "margin: .1em .5em .1em 2em;\n" 264 << "overflow: hidden;\n" 265 << "width: .8em; height: .8em;\n" 266 << "}\n" 267 << "div.blame_legend dl, div.blame_legend dd {\n" 268 << "display: inline;\n" 269 << "float: left;\n" 270 << "padding: 0;\n" 271 << "margin: 0;\n" 272 << "margin-right: 1.5em;\n" 273 << "}\n"; 247 274 s.close(); 248 275 } -
branches/replacing_gnuplot/lib/rmdirhier.cc
r784 r845 22 22 23 23 #include "rmdirhier.h" 24 #include "utility.h" 24 25 26 #include <cstring> 25 27 #include <dirent.h> 28 #include <cerrno> 26 29 #include <fcntl.h> 27 30 #include <iostream> … … 42 45 } 43 46 catch(const BadDirectory& x) { 44 std::cerr << "Invalid directory: " << x.what() << std::endl; 47 std::cerr << "svndigest: " << x.what() << "\n" 48 << strerror(errno) << std::endl; 45 49 } 46 50 catch(const DirectoryOpenError& x) { 47 std::cerr << "Error opening directory: " << x.what() << std::endl; 51 std::cerr << "svndigest: cannot open directory " << x.what() << "\n" 52 << strerror(errno) << "\n"; 48 53 } 49 54 catch(const FileDeleteError& x) { 50 std::cerr << "Error deleting file: " << x.what() << std::endl; 55 std::cerr << "svndigest: cannot delete file " << x.what() << "\n" 56 << strerror(errno) << "\n"; 51 57 } 52 58 catch(const DirectoryDeleteError& x) { 53 std::cerr << "Error deleting directory: " << x.what() << std::endl; 54 } 55 catch(const DirectoryError& x) { 56 std::cerr << "Directory error:" << x.what() << std::endl; 59 std::cerr << "svndigest: cannot delete directory " << x.what() << "\n" 60 << strerror(errno) << "\n"; 57 61 } 58 62 … … 71 75 chmod(dir.c_str(),S_IWRITE); 72 76 if (unlink(dir.c_str())) 73 throw FileDeleteError( dir);77 throw FileDeleteError(concatenate_path(pwd(),dir)); 74 78 return; 75 79 } 76 80 if (chdir(dir.c_str())) 77 throw BadDirectory( dir);81 throw BadDirectory(concatenate_path(pwd(),dir)); 78 82 79 83 // Delete any remaining directory entries … … 81 85 struct dirent *entry; 82 86 if (!(dp=opendir("."))) 83 throw DirectoryOpenError( dir);87 throw DirectoryOpenError(concatenate_path(pwd(),dir)); 84 88 while ((entry=readdir(dp)) != NULL) { 85 89 if ((std::string(entry->d_name) == ".") || … … 93 97 chdir(".."); 94 98 if (rmdir(dir.c_str())) 95 throw DirectoryDeleteError( dir);99 throw DirectoryDeleteError(concatenate_path(pwd(),dir)); 96 100 } 97 101 -
branches/replacing_gnuplot/lib/utility.cc
r784 r845 3 3 /* 4 4 Copyright (C) 2006, 2007, 2009 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2008 Peter Johansson5 Copyright (C) 2008, 2009 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 167 167 168 168 169 bool is_int(std::string s)170 {171 std::stringstream ss(s);172 int a;173 ss >> a;174 if(ss.fail())175 return false;176 // Check that nothing is left on stream177 std::string b;178 ss >> b;179 return b.empty();180 }181 182 183 169 std::string ltrim(std::string str) 184 170 { … … 197 183 throw std::runtime_error(ss.str()); 198 184 } 185 } 186 187 188 void mkdir_p(const std::string& dir) 189 { 190 if (node_exist(dir)) 191 return; 192 std::string mother = directory_name(dir); 193 mkdir_p(mother); 194 mkdir(dir); 199 195 } 200 196 -
branches/replacing_gnuplot/lib/utility.h
r784 r845 7 7 Copyright (C) 2005 Peter Johansson 8 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2009 Peter Johansson 9 10 10 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 61 62 62 63 /** 63 \brief convert string to (numerical) type64 65 \throw runtime_error if conversion fails66 */67 template<typename T>68 T convert(const std::string& s);69 70 /**71 64 @brief Copy file \a source to \a target. 72 65 … … 118 111 /// 119 112 std::string htrim(std::string str); 120 121 /**122 @return true if string \a s fulfills regular expression \verbatim123 ^\w* \endverbatim \a other \verbatim \w*$ \endverbatim (case124 insensitive)125 */126 bool is_equal(std::string s, std::string other);127 128 ///129 /// @return true if \a str is an integer130 ///131 bool is_int(std::string str);132 133 ///134 /// @return true if string is "nan" (case-insensitive)135 ///136 bool is_nan(const std::string& s);137 113 138 114 /// … … 160 136 /// 161 137 void mkdir(const std::string& dir); 138 139 /// 140 /// Create directory \a dir and parents directories if needed. No 141 /// error if \a dir already exists. 142 /// 143 void mkdir_p(const std::string& dir); 162 144 163 145 /// … … 244 226 std::string); 245 227 246 // template implementations247 template<typename T>248 T convert(const std::string& s)249 {250 if (is_nan(s))251 return std::numeric_limits<T>::quiet_NaN();252 if (is_equal(s, "inf"))253 return std::numeric_limits<T>::infinity();254 if (is_equal(s, "-inf")) {255 if (std::numeric_limits<T>::is_signed)256 return -std::numeric_limits<T>::infinity();257 else258 throw std::runtime_error(std::string("convert(\"")+s+259 std::string("\"): type is unsigned") );260 }261 262 std::stringstream ss(s);263 T a;264 ss >> a;265 bool ok = true;266 if(ss.fail())267 ok = false;268 // Check that nothing is left on stream269 std::string b;270 ss >> b;271 if (!b.empty() || !ok)272 throw std::runtime_error(std::string("convert(\"")+s+std::string("\")"));273 return a;274 }275 276 228 }} // end of namespace svndigest end of namespace theplu 277 229 -
branches/replacing_gnuplot/man/Makefile.am
r784 r845 22 22 dist_man1_MANS = $(srcdir)/svndigest.1 23 23 24 EXTRA_DIST = svndigest.x 25 24 26 MAINTAINERCLEANFILES = $(dist_man1_MANS) 25 27 … … 28 30 # is distributed it is recommended to depend on only distributed files 29 31 # (see automake manual 27.5). 30 $(srcdir)/svndigest.1: $(top_srcdir)/configure $(srcdir)/Makefile.in 32 $(srcdir)/svndigest.1: $(top_srcdir)/configure $(srcdir)/Makefile.in \ 33 $(srcdir)/svndigest.x 31 34 @$(HELP2MAN) --no-info -o $@ \ 35 --include $(srcdir)/svndigest.x \ 32 36 --version-option="--no-verbose --version" \ 33 37 $(top_builddir)/bin/svndigest$(EXEEXT) 34 38 else 35 39 $(srcdir)/svndigest.1: 36 40 echo "WARNING: bogus svndigest.1 is created" >&2; \ 37 41 echo 'ab help2man is required to generate this page' > $@ 38 42 -
branches/replacing_gnuplot/test/Makefile.am
r787 r845 3 3 ## $Id$ 4 4 5 # Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 # Copyright (C) 2009 Peter Johansson 5 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 7 6 # 8 7 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 23 22 check_SCRIPTS = svn_update.sh 24 23 25 check_PROGRAMS = config_test copyright_test date_test \ 24 check_PROGRAMS = cache_partial_test config_test copyright_test \ 25 date_test \ 26 26 parser_test stats_test trac_test utility_test 27 27 … … 38 38 LDADD = $(builddir)/libsvndigesttest.a \ 39 39 $(top_builddir)/lib/libsvndigest.a \ 40 $(top_builddir)/lib/yat/libyat.a \ 40 41 $(SVNDIGEST_LIBS) 41 42 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) … … 46 47 libsvndigesttest_a_SOURCES = Suite.cc 47 48 49 cache_partial_test_SOURCES = cache_partial_test.cc 48 50 config_test_SOURCES = config_test.cc 49 51 copyright_test_SOURCES = copyright_test.cc -
branches/replacing_gnuplot/test/Suite.cc
r784 r845 25 25 #include "environment.h" 26 26 27 #include "utility.h" 28 27 #include "Stats.h" 28 #include "StatsCollection.h" 29 #include "../lib/utility.h" 30 31 #include <algorithm> 29 32 #include <cassert> 30 33 #include <fstream> 31 34 #include <iostream> 35 #include <iterator> 32 36 #include <string> 33 37 … … 90 94 91 95 96 bool check_all(const Stats& stats, test::Suite& suite) 97 { 98 for (int lt=0; lt<=LineTypeParser::total; ++lt) { 99 for (svn_revnum_t rev=0; rev<=stats.revision(); ++rev) { 100 size_t all = 0; 101 for (std::set<std::string>::const_iterator a=stats.authors().begin(); 102 a!=stats.authors().end(); ++a) { 103 all += stats(lt, *a, rev); 104 } 105 if (all!=stats(lt, "all", rev)) { 106 suite.out() << "error: check_all\n" 107 << " lt = " << lt << "\n" 108 << " rev = " << rev << "\n" 109 << " all = " << all << "\n" 110 << " stats = " << stats(lt, "all", rev) << "\n"; 111 for (std::set<std::string>::const_iterator a=stats.authors().begin(); 112 a!=stats.authors().end(); ++a) { 113 suite.out() << *a << " " << stats(lt, *a, rev) << "\n"; 114 } 115 return false; 116 } 117 } 118 } 119 return true; 120 } 121 122 123 bool check_total(const Stats& stats, test::Suite& suite) 124 { 125 for (svn_revnum_t rev=0; rev<=stats.revision(); ++rev) { 126 for (std::set<std::string>::const_iterator a=stats.authors().begin(); 127 a!=stats.authors().end(); ++a) { 128 unsigned int total=0; 129 for (int lt=0; lt<4; ++lt) { 130 total += stats(lt, *a, rev); 131 } 132 unsigned int total2=stats(LineTypeParser::total, *a, rev); 133 134 if (total!=total2) { 135 suite.out() << "error: check_total\n" 136 << " author = " << *a << "\n" 137 << " rev = " << rev << "\n" 138 << " sum = " << total << "\n" 139 << " total = " << total2 << "\n"; 140 return false; 141 } 142 } 143 } 144 return true; 145 } 146 147 148 bool check_comment_or_copy(const Stats& stats, test::Suite& suite) 149 { 150 for (svn_revnum_t rev=0; rev<=stats.revision(); ++rev) { 151 for (std::set<std::string>::const_iterator a=stats.authors().begin(); 152 a!=stats.authors().end(); ++a) { 153 unsigned int x=stats(LineTypeParser::comment, *a, rev); 154 x+=stats(LineTypeParser::copyright, *a, rev); 155 unsigned int y=stats(LineTypeParser::comment_or_copy, *a, rev); 156 157 if (x!=y) { 158 suite.out() << "error: check_total\n" 159 << " author = " << *a << "\n" 160 << " rev = " << rev << "\n" 161 << " comment + copyright = " << x << "\n" 162 << " comment_or_copy = " << y << "\n"; 163 return false; 164 } 165 } 166 } 167 return true; 168 } 169 170 171 bool consistent(const StatsCollection& sc, test::Suite& suite) 172 { 173 std::map<std::string, Stats*>::const_iterator iter = sc.stats().begin(); 174 while (iter != sc.stats().end()) { 175 if (!consistent(*iter->second, suite)) { 176 suite.out() << "error in " << iter->first << "\n"; 177 return false; 178 } 179 ++iter; 180 } 181 return true; 182 } 183 184 185 bool consistent(const Stats& stats, test::Suite& suite) 186 { 187 suite.add(check_all(stats, suite)); 188 suite.add(check_total(stats, suite)); 189 suite.add(check_comment_or_copy(stats, suite)); 190 return true; 191 } 192 193 194 bool equal(const StatsCollection& a, const StatsCollection& b, 195 Suite& suite) 196 { 197 if (a.stats().size() != b.stats().size()) { 198 suite.out() << "size mismatch\n"; 199 return false; 200 } 201 std::map<std::string, Stats*>::const_iterator iter1 = a.stats().begin(); 202 std::map<std::string, Stats*>::const_iterator iter2 = b.stats().begin(); 203 while (iter1 != a.stats().end()) { 204 if (iter1->first != iter2->first) { 205 suite.out() << "key mismatch\n"; 206 suite.out() << iter1->first << " vs " << iter2->first << "\n"; 207 return false; 208 } 209 if (!equal(*iter1->second, *iter2->second, suite)) { 210 suite.out() << "error in " << iter1->first << "\n"; 211 return false; 212 } 213 ++iter1; 214 ++iter2; 215 } 216 return true; 217 } 218 219 220 bool equal(const Stats& a, const Stats& b, test::Suite& suite) 221 { 222 if (a.authors() != b.authors()) { 223 suite.out() << "authors are not equal\n"; 224 suite.out() << "lhs:\n"; 225 std::copy(a.authors().begin(), a.authors().end(), 226 std::ostream_iterator<std::string>(suite.out(), "\n")); 227 suite.out() << "rhs:\n"; 228 std::copy(b.authors().begin(), b.authors().end(), 229 std::ostream_iterator<std::string>(suite.out(), "\n")); 230 return false; 231 } 232 if (a.revision() != b.revision()) { 233 suite.out() << "revision mismatch\n"; 234 return false; 235 } 236 std::vector<std::string> authors; 237 authors.reserve(a.authors().size()+1); 238 std::copy(a.authors().begin(), a.authors().end(), 239 std::back_inserter(authors)); 240 authors.push_back("all"); 241 for (int linetype=0; linetype <= LineTypeParser::total; ++linetype) { 242 for (std::vector<std::string>::const_iterator author=authors.begin(); 243 author!=authors.end(); ++author) { 244 for (svn_revnum_t rev=0; rev<a.revision(); ++rev) { 245 size_t ax = a(linetype, *author, rev); 246 size_t bx = b(linetype, *author, rev); 247 if (ax != bx) { 248 suite.out() << "error: linetype: " << linetype 249 << " author " << *author 250 << " rev " << rev << "\n" 251 << " a: " << ax << "\n" 252 << " b: " << bx << "\n"; 253 return false; 254 } 255 } 256 } 257 } 258 return true; 259 } 260 261 92 262 void Suite::update_test_wc(void) const 93 263 { … … 114 284 115 285 286 std::string src_filename(const std::string& path) 287 { 288 return abs_srcdir()+"/"+path; 289 } 290 291 116 292 }}} -
branches/replacing_gnuplot/test/Suite.h
r784 r845 29 29 namespace theplu { 30 30 namespace svndigest { 31 class Stats; 32 class StatsCollection; 33 31 34 namespace test { 32 35 … … 65 68 }; 66 69 70 bool check_all(const Stats&, test::Suite&); 71 bool check_total(const Stats&, test::Suite&); 72 bool check_comment_or_copy(const Stats&, test::Suite&); 73 74 bool consistent(const StatsCollection&, test::Suite&); 75 bool consistent(const Stats&, test::Suite&); 76 77 bool equal(const StatsCollection& a, const StatsCollection& b, 78 test::Suite& suite); 79 80 bool equal(const Stats& a, const Stats& b, test::Suite& suite); 81 67 82 /** 68 83 \return absolute path to file 69 \param local_path path relative to srcdir84 \param local_path path relative to builddir 70 85 */ 71 86 std::string filename(const std::string& local_path); 72 87 88 /** 89 \return absolute path to file 90 \param path path relative to srcdir 91 */ 92 std::string src_filename(const std::string& path); 73 93 }}} 74 94 -
branches/replacing_gnuplot/test/config_test.cc
r784 r845 2 2 3 3 /* 4 Copyright (C) 2008 Peter Johansson4 Copyright (C) 2008, 2009 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 49 49 bool ok =true; 50 50 if (!c.codon("foo.h")){ 51 std::cerr << "No codon for test.cc\n";51 std::cerr << "No codon for foo.h\n"; 52 52 ok = false; 53 53 } -
branches/replacing_gnuplot/test/repo/db/current
r591 r845 1 6 1 1n41 64 1y 4 -
branches/replacing_gnuplot/test/test_repo.sh.in
r784 r845 32 32 fi 33 33 34 while test $# -gt 0; do 35 case "$1" in 36 -v) 37 VERBOSE=1 38 ;; 39 esac 40 shift 41 done 42 43 if test -z "$VERBOSE"; then 44 exec > /dev/null 45 fi 46 34 47 cd $abs_builddir && @SHELL@ svn_update.sh || exit 1; 35 48 … … 37 50 38 51 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir \ 39 --ignore-cache --no-report $1;52 --ignore-cache --no-report --verbose; 40 53 41 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir -f $1; 42 54 $abs_top_builddir/bin/svndigest -r $rootdir -t $targetdir -vf; -
branches/replacing_gnuplot/test/utility_test.cc
r784 r845 21 21 */ 22 22 23 #include " utility.h"23 #include "../lib/utility.h" 24 24 25 25 #include <algorithm>
Note: See TracChangeset
for help on using the changeset viewer.