Changeset 1100 for branches/src-highlight
- Timestamp:
- Jun 13, 2010, 7:28:19 PM (13 years ago)
- Location:
- branches/src-highlight
- Files:
-
- 11 deleted
- 115 edited
- 41 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/src-highlight
-
Property
svn:mergeinfo
set to
/branches/0.7-stable merged eligible /tags/0.7.3 merged eligible /trunk merged eligible
-
Property
svn:mergeinfo
set to
-
branches/src-highlight/.svndigest/config
r758 r1100 14 14 jari = Jari Häkkinen 15 15 peter = Peter Johansson 16 17 ### Section for images 18 [image] 19 format = png 20 anchor_format = png 21 22 ### Section for author color in plots and blame output. 23 [author-color] 24 # jdoe = 000000 25 jari = 0000aa 26 peter = aa0000 16 27 17 28 ### Section for setting trac environment … … 43 54 *.ac = "#":"\n" ; "dnl":"\n" 44 55 *.am = "#":"\n" 45 *.m4 = "#":"\n" ; "dnl":"\n" 56 *.as = "#":"\n" ; "dnl":"\n" 57 *.bat = "\nREM":"\n" ; "\nrem":"\n" 46 58 *.c = "//":"\n" ; "/*":"*/" 47 59 *.cc = "//":"\n" ; "/*":"*/" 48 60 *.cpp = "//":"\n" ; "/*":"*/" 61 *.css = "<!--":"-->" 49 62 *.cxx = "//":"\n" ; "/*":"*/" 50 63 *.h = "//":"\n" ; "/*":"*/" 51 64 *.hh = "//":"\n" ; "/*":"*/" 52 65 *.hpp = "//":"\n" ; "/*":"*/" 66 *.html = "<%--":"--%>" 53 67 *.java = "//":"\n" ; "/*":"*/" 68 *.jsp = "<!--":"-->" 69 *.m = "%":"\n" 70 *.m4 = "#":"\n" ; "dnl":"\n" 54 71 *.pl = "#":"\n" 55 72 *.pm = "#":"\n" 73 *.R = "#":"\n" 74 *.rss = "<!--":"-->" 75 *.sgml = "<!--":"-->" 56 76 *.sh = "#":"\n" 77 *.shtml = "<!--":"-->" 78 *.tex = "%":"\n" 79 *.xhtml = "<!--":"-->" 80 *.xml = "<!--":"-->" 81 *.xsd = "<!--":"-->" 82 *.xsl = "<!--":"-->" 57 83 *config = "#":"\n" 58 84 bootstrap = "#":"\n" 59 85 Makefile = "#":"\n" 60 *.tex = "%":"\n"61 *.m = "%":"\n"62 *.jsp = "<!--":"-->"63 *.html = "<%--":"--%>"64 *.xml = "<!--":"-->" ; "<!--":"-->"65 *.xsl = "<!--":"-->"66 *.xsd = "<!--":"-->"67 *.xhtml = "<!--":"-->"68 *.shtml = "<!--":"-->"69 *.css = "<!--":"-->"70 *.rss = "<!--":"-->"71 *.sgml = "<!--":"-->"72 *.bat = "\nREM":"\n" ; "\nrem":"\n" -
branches/src-highlight/AUTHORS
r768 r1100 1 1 $Id$ 2 2 3 Copyright (C) 2005, 2006, 2008 Jari Häkkinen 4 Copyright (C) 2007, 2008 Peter Johansson 3 Copyright (C) 2005, 2006 Jari Häkkinen 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 Files are copyright by their respective authors. The contributions to -
branches/src-highlight/ChangeLog
r811 r1100 26 26 {{{ 27 27 Copyright (C) 2005, 2006 Jari Häkkinen 28 Copyright (C) 2007 Jari Häkkinen, Peter Johansson29 Copyright (C) 200 8, 2009 Peter Johansson28 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 29 Copyright (C) 2009 Peter Johansson 30 30 31 31 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/Makefile.am
r821 r1100 4 4 5 5 # Copyright (C) 2005, 2006 Jari Häkkinen 6 # Copyright (C) 2007, 2008 Peter Johansson 6 # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2009, 2010 Peter Johansson 7 8 # 8 9 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 26 27 SUBDIRS = lib bin man test 27 28 28 EXTRA_dist = build_support/move-if-change 29 EXTRA_DIST = build_support/move-if-change .release_year 30 MOVE_IF_CHANGE = $(SHELL) $(top_srcdir)/build_support/move-if-change 31 32 lazycheck recheck: all 33 cd test && $(MAKE) $(AM_MAKEFLAGS) $@ 29 34 30 35 clean-local: 31 36 rm -rf svndigest *~ 32 37 33 if ENABLE_SVN_SUPPORT 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 38 .PHONY: .release_year.tmp recheck 39 if HAVE_SVN_WC 40 # update copyright year automatically (if we build from svn wc) 41 $(srcdir)/.release_year: $(builddir)/.release_year.tmp 42 @$(MOVE_IF_CHANGE) $(builddir)/.release_year.tmp $@ 43 44 $(builddir)/.release_year.tmp: 45 @if ($(SVNVERSION) $(top_srcdir) | $(GREP) M > /dev/null); then \ 46 date -u "+%Y" > $@; \ 47 else \ 48 cp $(srcdir)/.release_year $@; \ 49 fi 40 50 endif 41 51 42 52 43 # This is a workaround to avoid a broken make when .m4 files are 44 # renamed or deleted. Something similar will be provided by Automake 1.11 45 $(am__aclocal_m4_deps): 53 ############################################################## 54 ## 55 ## Some rules useful for maintainer 56 ## 57 58 include $(srcdir)/maintainer.am 59 60 # called within maintainer-check 61 ## We do wanna run all tests here since test repository is not 62 ## included in tarball, and thus some tests are skiped in distcheck. 63 MAINTAINER_CHECK_LOCAL = check 64 # extra check in release rule 65 RELEASE_LOCAL = check-svn_revision 66 67 .PHONY: check-svn_revision 68 69 check-svn_revision: 70 @$(SVNVERSION) | $(EGREP) '^[0-9]+$$' || \ 71 { echo incorrect svn revision - expected single unmodified revision 1>&2; \ 72 exit 1; } -
branches/src-highlight/NEWS
r768 r1100 3 3 See the end of this file for copyrights and conditions. 4 4 5 Version 0.7 (released DATE) 5 Version 0.8 (released NOT YET) 6 - Gnuplot replaced with plplot (ticket:97) 7 - option --copyright deprecated; use new program snvcopyright (ticket #307) 8 - new option --format (ticket:438) 9 - new option --anchor-format (ticket:279) 10 - new section, `[image]`, in config file (ticket:279 and ticket:405) 11 - new configure option --with-plplot 12 - new default codon for `*.as` in config file 13 - new default codon for `*.R` in config file (ticket:432) 14 - image format is configurable, refer to Manual (ticket:405) 15 16 A complete list of closed tickets can be found here [[br]] 17 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.8 18 19 svndigest 0.7.x series from 20 http://dev.thep.lu.se/svndigest/svn/branches/0.7-stable 21 22 Version 0.7.4 (released 8 June 2010) 23 - fixed memory bug in StatsCollection (r1075) 24 25 A complete list of closed tickets can be found here [[br]] 26 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7.4 27 28 Version 0.7.3 (released 15 February 2010) 29 - Fixed bug that authors were excluded in BlameStats plot (bug #441) 30 31 A complete list of closed tickets can be found here [[br]] 32 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7.3 33 34 Version 0.7.2 (released 2 January 2010) 35 - Author included in plot unless count is 0 for all revisions (bug #434) 36 - Default codons in config file is now corrected. Old cache files 37 are obsolete and are ignored by svndigest 0.7.2 (bug #431) 38 39 A complete list of closed tickets can be found here [[br]] 40 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7.2 41 42 Version 0.7.1 (released 3 December 2009) 43 - File name in parsing rules are matched against the file name and 44 not the entire path. This has no influence on most files because 45 the name starts with a wild card (*) but for files not doing so 46 (default bootstrap and Makefile) the correct parsing rule will be 47 used. It is recommended to remove the cache of such files before 48 running svndigest (ticket:417). 49 - copyright update works on mixed revision wc (ticket:415) 50 51 A complete list of closed tickets can be found here [[br]] 52 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7.1 53 54 Version 0.7 (released 22 November 2009) 6 55 - Upgraded to GLPv3 (ticket:339) 7 56 - configure option --enable-staticbin is removed (ticket:340) 8 57 - configure option --enable-wctests is removed (ticket:295) 58 - configure option --enable-svn-support is removed 9 59 - parsing rules can be set in config file (ticket:283) 60 - Statistics is now cached (ticket:5) 61 - More statistics: StatsType Blame (ticket:24) and StatsType Add (ticket:82) 10 62 11 63 A complete list of closed tickets can be found here [[br]] 12 64 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7 13 65 66 version 0.6.8 (released 12 November 2009) 67 - configure now handles --disable correctly (issue #383) 68 69 A complete list of closed tickets can be found here [[br]] 70 http://dev.thep.lu.se/svndigest/query?status=closed&milestone=svndigest+0.6.8 71 14 72 version 0.6.7 (released 1 February 2009) 15 73 - Improved TracLinks (issue #353) 16 - Daylight saving time is now handled correctly (issue #35 3)74 - Daylight saving time is now handled correctly (issue #356) 17 75 18 76 A complete list of closed tickets can be found here [[br]] … … 101 159 {{{ 102 160 Copyright (C) 2005, 2006 Jari Häkkinen 103 Copyright (C) 2007 Jari Häkkinen, Peter Johansson104 Copyright (C) 20 08, 2009Peter Johansson161 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 162 Copyright (C) 2010 Peter Johansson 105 163 106 164 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/README
r806 r1100 43 43 consequence, the dependency is inherited by svndigest. 44 44 45 * Gnuplot. 45 * PLplot, http://plplot.sourceforge.net, is used to generate graphics 46 in the output. You can build svndigest without PLplot if you run 47 configure with `--without-plplot`. 48 49 * pkg-config utility, http://pkg-config.freedesktop.org, is used to 50 query information about PLplot headers and libs. It is possible to 51 configure and build without pkg-config, but we recommend that you 52 have pkg-config available because it makes detection of PLplot much 53 more automatic and convenient. 46 54 47 55 * A standard C++ compliant compiler with one extension: svndigest … … 54 62 flag to suppress 'long long' diagnostics, -Wno-long-long. 55 63 64 === Optional === 65 66 * src-highlite available from http://www.gnu.org/software/src-highlite 56 67 57 68 == Installing svndigest == … … 71 82 72 83 The `./configure` script accepts a few options of interest for 73 svndigest. You can provide `./configure` with APR and subversion API74 location information with `--with-apr=DIR` and `--with-svn=DIR`,75 respectively.84 svndigest. You can provide `./configure` with APR, subversion, and 85 PLplot API location information with `--with-apr=DIR`, 86 `--with-svn=DIR`, and `--with-plplot=DIR, respectively. 76 87 77 88 If you grabbed the source from the subversion repository you need to … … 114 125 {{{ 115 126 Copyright (C) 2005, 2006 Jari Häkkinen 116 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 117 Copyright (C) 2009 Peter Johansson 127 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 118 128 119 129 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/README.developer
r839 r1100 24 24 25 25 To build from a subversion checkout, you will need Autotools. More 26 specifically Automake 1.10 (or later) and Autoconf 2.6 1(or later). To26 specifically Automake 1.10 (or later) and Autoconf 2.63 (or later). To 27 27 build man page you will need help2man. 28 28 … … 54 54 Test programs should be created and added to the `make check` 55 55 execution. Always check that the test runs before committing code to 56 the repository, i.e., run `make check`. 56 the repository, i.e., run `make check`. For more details on how to run 57 and write tests, please refer to file `test/README`. 57 58 58 59 There is a test repository in source:trunk/test/repo that is a part of … … 116 117 shared between authors. 117 118 119 == Design and Motivation == 120 121 Please refer to source:trunk/doc/HACKING for a list of design 122 decisions we try to follow. 118 123 119 124 == Releasing == … … 125 130 {{{ 126 131 Copyright (C) 2005, 2006 Jari Häkkinen 127 Copyright (C) 2007 Jari Häkkinen, Peter Johansson128 Copyright (C) 200 8Peter Johansson132 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 133 Copyright (C) 2009 Peter Johansson 129 134 130 135 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/THANKS
r799 r1100 1 1 $Id$ 2 3 svndigest uses a C++ interface to Gnuplot inspired by Rajarshi Guha.4 5 Rajarshi Guha's "A C++ Interface to Gnuplot" can be found through6 http://jijo.cjb.net/ . The C++ interface is based on "gnuplot7 interfaces in ANSI C" written by Nicolas Devillard. The C8 implementation is available through http://ndevilla.free.fr/ .9 2 10 3 svndigest build system uses an M4 macro (m4/find_apr.m4) created … … 26 19 27 20 svndigest build system uses a shell script 28 (build_support/move-if-change d) that was copied from GCC. The script21 (build_support/move-if-change) that was copied from GCC. The script 29 22 is licensed under GNU GPL <http://www.gnu.org/licenses/>. 30 23 … … 32 25 {{{ 33 26 Copyright (C) 2005, 2006 Jari Häkkinen 34 Copyright (C) 2007 Jari Häkkinen, Peter Johansson35 Copyright (C) 200 8Peter Johansson27 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 28 Copyright (C) 2009, 2010 Peter Johansson 36 29 37 30 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/bin/Makefile.am
r795 r1100 4 4 5 5 # Copyright (C) 2005 Jari Häkkinen 6 # Copyright (C) 2006 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2007, 2008 Peter Johansson 8 # Copyright (C) 2008 Jari Häkkinen, Peter Johansson 6 # Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2010 Peter Johansson 9 8 # 10 9 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 23 22 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 24 23 25 bin_PROGRAMS = svndigest 24 bin_PROGRAMS = svndigest svncopyright 26 25 27 svndigest_SOURCES = Parameter.cc svndigest.cc 26 svndigest_SOURCES = Parameter.cc svndigestParameter.cc svndigest.cc 27 svncopyright_SOURCES = Parameter.cc svncopyrightParameter.cc svncopyright.cc 28 28 29 noinst_HEADERS = Parameter.h 29 noinst_HEADERS = Parameter.h svncopyrightParameter.h svndigestParameter.h 30 31 bin_SCRIPTS = svndigest-copy-cache 32 EXTRA_DIST = svndigest-copy-cache.as 30 33 31 34 LDADD = $(top_builddir)/lib/libsvndigest.a \ 32 $(top_builddir)/lib/yat/libyat.a $(SVN DIGEST_LIBS)33 AM_LDFLAGS = $( SVNDIGEST_LDFLAGS)35 $(top_builddir)/lib/yat/libyat.a $(SVN_LIBS) $(APR_LIBS) $(PLPLOT_LIBS) 36 AM_LDFLAGS = $(APR_LDFLAGS) $(SVN_LDFLAGS) $(PLPLOT_LDFLAGS) 34 37 35 AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS) 36 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 38 AM_CPPFLAGS = -I$(top_srcdir)/lib $(DEFAULT_CPPFLAGS) \ 39 $(APR_CPPFLAGS) $(SVN_CPPFLAGS) $(PLPLOT_CPPFLAGS) 40 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS) 37 41 42 ##svndigest_LDADD = $(LDADD) $(PLPLOT_LIBS) 43 ##svndigest_LDFLAGS = $(AM_LDFLAGS) $(PLPLOT_LDFLAGS) 44 ##svndigest_CPPFLAGS = $(AM_CPPFLAGS) $(PLPLOT_CPPFLAGS) 45 46 .as.in: 47 $(AUTOM4TE) -l M4sh -o $@ $(M4SH_OPTIONS) $< 48 49 MAINTAINERCLEANFILES = svndigest-copy-cache.in 38 50 39 51 clean-local: -
branches/src-highlight/bin/Parameter.cc
r830 r1100 2 2 3 3 /* 4 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 4 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 19 20 along with svndigest. If not, see <http://www.gnu.org/licenses/>. 20 21 */ 22 23 #include <config.h> // this header file is created by configure 21 24 22 25 #include "Parameter.h" … … 30 33 #include "yat/OptionHelp.h" 31 34 #include "yat/OptionSwitch.h" 32 33 #include <config.h> // this header file is created by configure34 35 35 36 #include <cassert> … … 44 45 #include <sys/stat.h> 45 46 46 // FIXME: remove this when we require autoconf 2.6447 // autoconf 2.64 defines PACKAGE_URL in config.h (from AC_INIT)48 #ifndef PACKAGE_URL49 #define PACKAGE_URL "http://dev.thep.lu.se/svndigest"50 #endif51 52 47 namespace theplu { 53 48 namespace svndigest { 54 49 55 Parameter::Parameter( int argc, char *argv[])50 Parameter::Parameter(void) 56 51 : cmd_( std::string("Mandatory arguments to long options ") + 57 52 std::string("are mandatory for short options too.")), 58 53 config_file_(cmd_, "config-file", 59 54 "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 55 generate_config_(cmd_, "g,generate-config", 65 56 "write configuration to standard output"), … … 68 59 std::string("ignore cache files and analyze ") + 69 60 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 61 root_(cmd_, "r,root", 74 62 "svn controlled directory to perform statistics on [.]"), 75 target_(cmd_, "t,target", "output directory [.]"),76 63 verbose_(cmd_, "v,verbose", "explain what is being done"), 77 64 version_(cmd_, "version", "print version information and exit", &verbose_) 65 { 66 } 67 68 void Parameter::parse(int argc, char* argv[]) 78 69 { 79 70 init(); … … 86 77 } 87 78 88 // set default values 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")); 79 set_default(); 97 80 98 81 // analyse arguments … … 114 97 check_existence(root_.value()); 115 98 check_readable(root_.value()); 116 if (chdir(root_.value().c_str())) { 117 std::stringstream ss; 118 ss << "svndigest: cannot read `" << root_.value() << "': " 119 << strerror(errno); 120 throw yat::utility::cmd_error(ss.str()); 121 } 99 chdir(root_.value()); 122 100 root_.value(pwd()); 123 chdir(save_wd.c_str()); 124 125 // check target (only if we write report) 126 if (report()) { 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")) { 132 std::stringstream ss; 133 ss << "svndigest: cannot create directory `" << path 134 << "': " << strerror(errno); 135 throw yat::utility::cmd_error(ss.str()); 136 } 137 if (node_exist(path) && !force()) { 138 std::stringstream ss; 139 ss << "svndigest: cannot create directory `" << path << "' " 140 << strerror(EEXIST); 141 throw yat::utility::cmd_error(ss.str()); 142 } 143 if (chdir(target_.value().c_str())) { 144 std::stringstream ss; 145 ss << "svndigest: cannot read `" << target_.value() << "': " 146 << strerror(errno); 147 throw yat::utility::cmd_error(ss.str()); 148 } 149 target_.value(pwd()); 150 chdir(save_wd.c_str()); 151 } 101 chdir(save_wd); 152 102 } 153 103 … … 164 114 check_readable(config_file_.value()); 165 115 stat(config_file_.value().c_str(), &nodestat); 166 if ( !S_ISREG(nodestat.st_mode)) {116 if (S_ISDIR(nodestat.st_mode)) { 167 117 std::stringstream ss; 168 ss << "svndigest: `" << config_file_.value()169 << "' is not a regular file";118 ss << cmd_.program_name() << ": `" << config_file_.value() 119 << "' is a directory"; 170 120 throw yat::utility::cmd_error(ss.str()); 171 121 } 172 122 } 123 analyse2(); 173 124 } 174 125 … … 179 130 return; 180 131 std::stringstream ss; 181 ss << "svndigest: cannot stat `" << path << "': " << strerror(errno); 132 ss << cmd_.program_name() << ": cannot stat `" << path << "': " 133 << strerror(errno); 182 134 throw yat::utility::cmd_error(ss.str()); 183 135 } … … 189 141 return; 190 142 std::stringstream ss; 191 ss << "svndigest: cannot open `" << path << "': " << strerror(errno); 143 ss << cmd_.program_name() << ": cannot open `" << path << "': " 144 << strerror(errno); 192 145 throw yat::utility::cmd_error(ss.str()); 193 146 } … … 200 153 201 154 202 bool Parameter::copyright(void) const203 {204 return copyright_.present();205 }206 207 208 bool Parameter::force(void) const209 {210 return force_.present();211 }212 213 214 155 bool Parameter::generate_config(void) const 215 156 { … … 226 167 void Parameter::init(void) 227 168 { 228 // don't use argv[0] because user may rename the binary229 cmd_. program_name() = PACKAGE_NAME;169 // we like the options sorted alphabetically 170 cmd_.sort(); 230 171 config_file_.print_arg("=FILE"); 231 172 root_.print_arg("=ROOT"); 232 target_.print_arg("=TARGET");233 173 std::stringstream ss; 234 174 ss << "Report bugs to " << PACKAGE_BUGREPORT << ".\n" 235 175 << PACKAGE << " home page: <" << PACKAGE_URL << ">.\n"; 236 176 help_.post_arguments() = ss.str(); 237 help_.synopsis() = 238 "Generate statistical report for a subversion repository\n"; 239 } 240 241 242 bool Parameter::report(void) const 243 { 244 return report_.value(); 245 } 246 247 248 bool Parameter::revisions(void) const 249 { 250 return revisions_.present(); 177 init2(); 251 178 } 252 179 … … 257 184 } 258 185 259 260 std::string Parameter::targetdir(void) const 261 { 262 return target_.value(); 263 } 264 265 186 void Parameter::set_default(void) 187 { 188 if (!root_.present()) 189 root_.value("."); 190 191 if (!config_file_.present()) 192 config_file_.value(concatenate_path(root_.value(),".svndigest/config")); 193 194 set_default2(); 195 } 196 197 266 198 bool Parameter::verbose(void) const 267 199 { -
branches/src-highlight/bin/Parameter.h
r820 r1100 5 5 6 6 /* 7 Copyright (C) 2006 Jari Häkkinen, Peter Johansson8 Copyright (C) 200 7, 2008Peter Johansson7 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009, 2010 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 47 47 class Parameter { 48 48 public: 49 Parameter( int argc, char *argv[]);49 Parameter(void); 50 50 virtual ~Parameter(void); 51 void parse( int argc, char *argv[]); 52 51 53 std::string config_file(void) const; 52 54 53 bool copyright(void) const;54 bool force(void) const;55 55 bool generate_config(void) const ; 56 56 bool ignore_cache(void) const; 57 bool report(void) const;58 bool revisions(void) const;59 57 /// @return absolute path to root directory 60 58 std::string root(void) const; 61 /// @return absolute path to target directory62 std::string targetdir(void) const;63 59 bool verbose(void) const; 64 60 65 private: 66 void analyse(void); 61 protected: 62 yat::utility::CommandLine cmd_; 63 yat::utility::OptionHelp help_; 64 67 65 // throw cmd_error if path doesn't exist 68 66 void check_existence(std::string path) const; … … 72 70 void check_readable(std::string path) const; 73 71 72 private: 73 void analyse(void); 74 virtual void analyse2(void)=0; 74 75 void init(void); 76 // called at end of init(void) 77 virtual void init2(void) = 0; 78 void set_default(void); 79 virtual void set_default2(void)=0; 75 80 76 yat::utility::CommandLine cmd_;77 81 yat::utility::OptionArg<std::string> config_file_; 78 yat::utility::OptionSwitch copyright_;79 yat::utility::OptionSwitch force_;80 82 yat::utility::OptionSwitch generate_config_; 81 yat::utility::OptionHelp help_;82 83 yat::utility::OptionSwitch ignore_cache_; 83 yat::utility::OptionSwitch report_;84 yat::utility::OptionSwitch revisions_;85 84 yat::utility::OptionArg<std::string> root_; 86 yat::utility::OptionArg<std::string> target_;87 85 yat::utility::OptionSwitch verbose_; 86 protected: 88 87 OptionVersion version_; 89 88 -
branches/src-highlight/bin/svndigest.cc
r808 r1100 2 2 3 3 /* 4 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson5 Copyright (C) 20 08, 2009Peter Johansson4 Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 21 21 */ 22 22 23 #include " Parameter.h"23 #include "svndigestParameter.h" 24 24 25 25 #include "Configuration.h" … … 27 27 #include "Directory.h" 28 28 #include "first_page.h" 29 #include "G nuplotFE.h"29 #include "Graph.h" 30 30 #include "html_utility.h" 31 #include "main_utility.h" 31 32 #include "rmdirhier.h" 32 33 #include "Stats.h" … … 38 39 39 40 #include "yat/Exception.h" 41 #include "yat/OptionArg.h" 40 42 41 43 #include <cassert> 44 #include <cstdlib> 42 45 #include <iostream> 43 46 #include <fstream> … … 47 50 #include <unistd.h> 48 51 52 using namespace theplu; 53 using namespace svndigest; 54 void copy_option2config(const svndigestParameter&, Configuration&); 55 49 56 void create_file_struct(std::string stats_type, 50 57 const theplu::svndigest::Stats& stats); 51 58 59 void write_report(const svndigestParameter& option, const std::string& repo, 60 const Node& tree, const StatsCollection& stats); 61 52 62 int main( int argc, char* argv[]) 53 63 { 54 using namespace theplu;55 using namespace svndigest;56 64 57 65 // Reading commandline options 58 Parameter* option=NULL;59 try { 60 option = new Parameter(argc,argv);61 if (option ->verbose())66 svndigestParameter option; 67 try { 68 option.parse(argc,argv); 69 if (option.verbose()) 62 70 std::cout << "Done parsing parameters" << std::endl; 63 71 } 64 72 catch (yat::utility::cmd_error& e) { 65 73 std::cerr << e.what() << std::endl; 66 exit( -1);67 } 68 assert(option);69 70 // Reading configuration file71 Configuration& config = Configuration::instance();72 if (node_exist(option->config_file())) { 73 std::ifstream is(option->config_file().c_str());74 if (!is.good()){75 is.close();76 std::cerr << "\nsvndigest: Cannot open config file "77 << option->config_file() << std::endl;78 exit(-1);74 exit(EXIT_FAILURE); 75 } 76 catch (std::runtime_error& e) { 77 std::cerr << "svndigest: " << e.what() << std::endl; 78 return EXIT_FAILURE; 79 } 80 81 try { 82 load_config(option.config_file()); 83 copy_option2config(option, Configuration::instance()); 84 if (option.generate_config()) { 85 std::cout << Configuration::instance(); 86 return EXIT_SUCCESS; 79 87 } 80 try { 81 config.load(is); 88 89 if (option.verbose()) 90 std::cout << "Initializing SVN singleton." << std::endl; 91 SVN::instance(option.root()); 92 93 // Extract repository location 94 std::string repo=SVNinfo(option.root()).repos_root_url(); 95 96 // build directory tree already here ... if WC is not upto date with 97 // repo an exception is thrown. This avoids several costly 98 // statements below and will not remove a digest tree below if a 99 // tree already exists. 100 if (option.verbose()) 101 std::cout << "Building directory tree" << std::endl; 102 Directory tree(0,option.root(),""); 103 104 if (option.verbose()) 105 std::cout << "Parsing directory tree" << std::endl; 106 const StatsCollection& stats(tree.parse(option.verbose(), 107 option.ignore_cache())); 108 109 if (option.report()) 110 write_report(option, repo, tree, stats); 111 112 if (option.copyright()){ 113 update_copyright(tree, option.verbose()); 82 114 } 83 catch (std::runtime_error e) { 84 std::cerr << "svndigest: invalid config file\n" 85 << e.what() << std::endl; 86 exit(-1); 87 } 88 is.close(); 115 } 116 catch (std::runtime_error& e) { 117 std::cerr << "svndigest: " << e.what() << "\n"; 118 return EXIT_FAILURE; 119 } 120 121 if (option.verbose()) 122 std::cout << "Done!" << std::endl; 123 return EXIT_SUCCESS; // normal exit 124 } 125 126 127 void copy_option2config(const svndigestParameter& option, Configuration& config) 128 { 129 try { 130 if (option.format().present()) 131 Configuration::instance().image_format(option.format().value()); 132 } 133 catch (std::runtime_error& e) { 134 std::stringstream ss; 135 ss << "invalid argument `" 136 << option.format().value() << "' for `--" 137 << option.format().long_name() << "'\n" 138 << e.what() << "\n" 139 << "Try `svndigest --help' for more information.\n"; 140 throw std::runtime_error(ss.str()); 141 } 142 try { 143 if (option.anchor_format().present()) 144 config.image_anchor_format(option.anchor_format().value()); 145 } 146 catch (std::runtime_error& e) { 147 std::stringstream ss; 148 ss << "invalid argument `" 149 << option.anchor_format().value() << "' for `--" 150 << option.anchor_format().long_name() << "'\n" 151 << e.what() << "\n" 152 << "Try `svndigest --help' for more information.\n"; 153 throw std::runtime_error(ss.str()); 154 } 155 } 156 157 158 void create_file_struct(std::string stats_type, 159 const theplu::svndigest::Stats& stats) 160 { 161 using namespace theplu::svndigest; 162 mkdir(stats_type); 163 touch(stats_type+std::string("index.html")); 164 mkdir(stats_type+std::string("all")); 165 mkdir(stats_type+std::string("images")); 166 touch(stats_type+std::string("all/index.html")); 167 touch(stats_type+std::string("images/index.html")); 168 for (std::set<std::string>::const_iterator i = stats.authors().begin(); 169 i!=stats.authors().end(); ++i) { 170 mkdir(stats_type+*i); 171 touch(stats_type+*i+std::string("/index.html")); 172 } 173 } 174 175 void remove_target(const std::string& target_path, bool verbose) 176 { 177 if (verbose) 178 std::cout << "Removing old target tree: " << target_path << "\n"; 179 rmdirhier(target_path); 180 // exit if remove failed 181 if (node_exist(target_path)) 182 throw std::runtime_error("remove failed"); 183 } 184 185 186 void set_dates(const std::string& repo, bool verbose) 187 { 188 if (verbose) 189 std::cout << "retrieving dates" << std::endl; 190 SVNlog log(repo); 191 std::vector<std::string> dates; 192 dates.reserve(log.commits().size()); 193 for (SVNlog::container::const_iterator iter=log.commits().begin(); 194 iter!=log.commits().end(); ++iter) { 195 assert(static_cast<svn_revnum_t>(dates.size())==iter->revision()); 196 dates.push_back(iter->date()); 197 } 198 // all plots uses the same dates 199 Graph::set_dates(dates); 200 } 201 202 void write_report(const svndigestParameter& option, const std::string& repo, 203 const Node& tree, const StatsCollection& stats) 204 { 205 std::string target_path = concatenate_path(option.targetdir(), 206 file_name(option.root())); 207 // remove target if needed 208 if (node_exist(target_path)) { 209 assert(option.force()); 210 remove_target(target_path, option.verbose()); 89 211 } 90 212 91 // write configuration 92 if (option->generate_config()) { 93 std::cout << config; 94 exit(0); 95 } 96 97 SVN* svn=NULL; 98 try { 99 if (option->verbose()) 100 std::cout << "Initializing SVN singleton." << std::endl; 101 svn=SVN::instance(option->root()); 102 } 103 catch (SVNException e) { 104 std::cerr << "svndigest: " << e.what() << "\n"; 105 exit(-1); 106 } 107 108 // check if target already exists and behave appropriately 109 bool need_to_erase_target=false; 110 std::string target_path=option->targetdir() + '/' + file_name(option->root()); 111 if (option->report()) { 112 if (option->verbose()) 113 std::cout << "Checking target directory" << std::endl; 114 need_to_erase_target = node_exist(target_path); 115 if (need_to_erase_target && !option->force()) { 116 std::cerr << "svndigest: directory `" 117 << target_path << "' already exists\n"; 118 exit(-1); 119 } 120 } 121 122 // Extract repository location 123 std::string repo; 124 try { 125 if (option->verbose()) 126 std::cout << "Acquiring repository information" << std::endl; 127 repo=SVNinfo(option->root()).repos_root_url(); 128 } 129 catch (SVNException e) { 130 std::cerr << "\nsvndigest: " << e.what() 131 << "\nsvndigest: Failed to determine repository for " 132 << option->root() << '\n' << std::endl; 133 exit(-1); 134 } 135 136 // build directory tree already here ... if WC is not upto date with 137 // repo an exception is thrown. This avoids several costly 138 // statements below and will not remove a digest tree below if a 139 // tree already exists. 140 if (option->verbose()) 141 std::cout << "Building directory tree" << std::endl; 142 Directory* tree=NULL; 143 try { 144 tree = new Directory(0,option->root(),""); 145 } 146 catch (NodeException e) { 147 std::cerr << "svndigest: " << e.what() << std::endl; 148 exit(-1); 149 } 150 assert(tree); 151 152 if (option->verbose()) 153 std::cout << "Parsing directory tree" << std::endl; 154 StatsCollection stats(tree->parse(option->verbose(), option->ignore_cache())); 155 156 if (option->report()) { 157 // remove target if needed 158 if (need_to_erase_target) { 159 if (option->verbose()) 160 std::cout << "Removing old target tree: " << target_path << "\n"; 161 rmdirhier(target_path); 162 // exit if remove failed 163 if (node_exist(target_path)) { 164 std::cerr << "svndigest: remove failed\n"; 165 exit(-1); 166 } 167 } 168 169 170 if (option->verbose()) 171 std::cout << "Generating output" << std::endl; 172 if (!option->revisions()) { 173 SVNlog log(repo); 174 std::vector<std::string> dates; 175 dates.reserve(log.commits().size()); 176 for (SVNlog::container::const_iterator iter=log.commits().begin(); 177 iter!=log.commits().end(); ++iter) { 178 assert(static_cast<svn_revnum_t>(dates.size())==iter->revision()); 179 dates.push_back(iter->date()); 180 } 181 GnuplotFE::instance()->set_dates(dates); 182 } 183 if (chdir(option->targetdir().c_str()) ) { 184 std::cerr << "svndigest: chdir " << option->targetdir() << " failed\n"; 185 exit(-1); 186 } 187 mkdir(tree->name()); 188 if (chdir(tree->name().c_str()) ) { 189 std::cerr << "svndigest: chdir " << tree->name() << " failed\n"; 190 exit(-1); 191 } 192 GnuplotFE::instance()->command(std::string("cd '")+option->targetdir()+"/" 193 +tree->name()+"'"); 194 print_css("svndigest.css"); 195 print_main_page(tree->name(), tree->log(), stats, tree->url()); 196 // create structure StatsType/Author/LineType 197 for (std::map<std::string, Stats*>::const_iterator i(stats.stats().begin()); 198 i!=stats.stats().end(); ++i) 199 create_file_struct(i->first+std::string("/"), *i->second); 200 try { 201 tree->print(option->verbose()); 202 } 203 catch (const std::runtime_error& x) { 204 std::cerr << "svndigest: " << x.what() << std::endl; 205 exit(-1); 206 } 207 } 208 209 if (option->copyright()){ 210 try { 211 if (option->verbose()) 212 std::cout << "Updating copyright statements" << std::endl; 213 std::map<std::string, Alias> alias(config.copyright_alias()); 214 tree->print_copyright(alias, option->verbose()); 215 } 216 catch (const std::runtime_error& x) { 217 std::cerr << "svndigest: " << x.what() << std::endl; 218 exit(-1); 219 } 220 } 221 222 if (option->verbose()) 223 std::cout << "Finalizing" << std::endl; 224 225 delete tree; 226 if (option->verbose()) 227 std::cout << "Done!" << std::endl; 228 delete option; 229 exit(0); // normal exit 230 } 231 232 void create_file_struct(std::string stats_type, 233 const theplu::svndigest::Stats& stats) 234 { 235 using namespace theplu::svndigest; 236 mkdir(stats_type); 237 touch(stats_type+std::string("index.html")); 238 mkdir(stats_type+std::string("all")); 239 mkdir(stats_type+std::string("images")); 240 touch(stats_type+std::string("all/index.html")); 241 touch(stats_type+std::string("images/index.html")); 242 for (std::set<std::string>::const_iterator i = stats.authors().begin(); 243 i!=stats.authors().end(); ++i) { 244 mkdir(stats_type+*i); 245 touch(stats_type+*i+std::string("/index.html")); 246 } 247 } 213 if (!option.revisions()) 214 set_dates(repo, option.verbose()); 215 216 chdir(option.targetdir()); 217 218 if (option.verbose()) 219 std::cout << "Generating output" << std::endl; 220 mkdir(tree.name()); 221 chdir(tree.name().c_str()); 222 print_css("svndigest.css"); 223 print_main_page(tree.name(), tree.log(), stats, tree.url()); 224 // create structure StatsType/Author/LineType 225 for (std::map<std::string, Stats*>::const_iterator i(stats.stats().begin()); 226 i!=stats.stats().end(); ++i) 227 create_file_struct(i->first+std::string("/"), *i->second); 228 tree.print(option.verbose()); 229 } -
branches/src-highlight/bootstrap
r768 r1100 8 8 9 9 # Copyright (C) 2005, 2006 Jari Häkkinen 10 # Copyright (C) 2007, 2008 Peter Johansson10 # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 11 11 # 12 12 # This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/configure.ac
r835 r1100 12 12 # Copyright (C) 2005 Jari Häkkinen, Peter Johansson 13 13 # Copyright (C) 2006 Jari Häkkinen 14 # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson15 # Copyright (C) 20 09Peter Johansson14 # Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 15 # Copyright (C) 2010 Peter Johansson 16 16 # 17 17 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 30 30 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 31 31 32 AC_PREREQ( 2.61)32 AC_PREREQ([2.63]) 33 33 34 34 m4_include([m4/version.m4]) 35 AC_INIT([svndigest], [SVNDIGEST_VERSION],[jari@thep.lu.se],,35 AC_INIT([svndigest], m4_defn([SVNDIGEST_VERSION]),[jari@thep.lu.se],, 36 36 [http://dev.thep.lu.se/svndigest]) 37 37 AC_CONFIG_SRCDIR([lib/File.h]) … … 40 40 AC_CONFIG_MACRO_DIR([m4]) 41 41 AC_PREFIX_DEFAULT([/usr/local]) 42 43 dnl FIXME remove when we assume autoconf 2.64 44 m4_ifndef([AC_PACKAGE_URL], 45 [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"], 46 [Define to home page for this package]) 47 AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"])]) 48 49 # propagate RELEASE_YEAR from file .release_year 50 RELEASE_YEAR=`cat $srcdir/.release_year` 51 AC_SUBST([RELEASE_YEAR]) 52 AC_DEFINE_UNQUOTED([RELEASE_YEAR], ["$RELEASE_YEAR"], 53 [Define year package was last modified]) 54 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/.release_year']) 42 55 43 56 AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION]) … … 54 67 [Define to the svndigest patch version]) 55 68 56 AC_CONFIG_HEADER([config.h]) 57 AM_INIT_AUTOMAKE([1.10 std-options check-news]) 69 AC_CONFIG_HEADERS([config.h]) 70 AM_INIT_AUTOMAKE([1.11 color-tests std-options parallel-tests]) 71 72 dnl create bin/svndigest-copy-cache.in at autoconf time and let 73 dnl config.status create bin/svndigest-copy-cache from 74 dnl bin/svndigest-copy-cache.in 75 m4_pushdef([FILE], [svndigest-copy-cache]) 76 m4_pushdef([my_m4sh_options], [-m 0644]) 77 dnl me cd down in bin to have same output as when created from Makefile 78 m4_syscmd([cd bin && autom4te -l M4sh -o ]FILE[.in ]my_m4sh_options FILE[.as]) 79 AC_CONFIG_FILES([bin/]FILE[], [chmod +x bin/]FILE[ && chmod a-w bin/]FILE[]) 80 dnl export options so we can use the same in Makefile 81 AC_SUBST([M4SH_OPTIONS], ['my_m4sh_options']) 82 m4_popdef([my_m4sh_options]) 83 m4_popdef([FILE]) 84 AM_MISSING_PROG([AUTOM4TE], [autom4te]) 58 85 59 86 # Set default programming language 60 AC_LANG( C++)87 AC_LANG([C++]) 61 88 62 89 # propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS … … 78 105 AC_PROG_CXXCPP 79 106 AC_PROG_CXX 80 AC_PROG_INSTALL81 107 AC_PROG_RANLIB 82 108 AC_PROG_SED 83 109 AC_PATH_PROG([HELP2MAN], [help2man], [no]) 84 AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno]) 85 AC_PATH_PROG([GNUPLOT],[gnuplot],[no]) 86 AC_DEFINE_UNQUOTED([GNUPLOT_PATH], ["$GNUPLOT"], 87 [defined to gnuplot path (or no if gnuplot was not found)]) 110 # look for pkg-config 111 PKG_PROG_PKG_CONFIG([0.23]) 88 112 89 113 # Save FLAGS 90 SAVE_CPPFLAGS="$CPPFLAGS" 91 SAVE_CXXFLAGS="$CXXFLAGS" 92 SAVE_LDFLAGS="$LDFLAGS" 93 SAVE_LIBS="$LIBS" 114 APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) 115 APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) 94 116 95 117 # -Wno-long-long is needed to suppress compiler diagnostics regarding 96 118 # using extension beyond the C++ standard (usage of non C++ standard 97 119 # 'long long' types). 98 YAT_CXX_ADD_FLAG([ SD_CXXFLAGS],[-pedantic -Wno-long-long])120 YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long]) 99 121 AC_TYPE_LONG_LONG_INT 100 122 AS_IF([test x$ac_cv_type_long_long_int = xno], … … 103 125 104 126 AC_ARG_ENABLE([debug], 105 [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], 106 [YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-g -O])], 107 [YAT_CPP_ADD_FLAG([SD_CPPFLAGS],[-DNDEBUG]) 108 YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-O3])]) 109 110 # enable svn-support 111 AC_ARG_ENABLE([svn-support], 112 [AS_HELP_STRING([--enable-svn-support], 113 [enable svn support - used by maintainer])]) 114 115 AS_IF([test "x$enable_svn_support" = xyes], 116 [AS_IF([test -d $srcdir/.svn], [], 117 [AC_MSG_ERROR([svn support cannot be enabled: `$srcdir' is not an svn wc.])])]) 118 AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn_support" = "xyes"]) 127 [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) 128 129 AS_IF([test x$enable_debug = xyes], 130 [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])], 131 [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG]) 132 YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])]) 119 133 120 134 # Apache Portable Runtime (APR) API checks 121 APR_FIND_APR(,, 1,[1 0])135 APR_FIND_APR(,,[1],[1 0]) 122 136 AS_IF([test "${with_apr+set}" = set], 123 137 [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"] 124 138 ) 125 139 if test "$apr_found" = "yes" ; then 126 SD_LIBS="`$apr_config --libs` $SD_LIBS"127 apr_link_ld= `$apr_config --link-ld`140 APR_LIBS="`$apr_config --libs`" 141 apr_link_ld="`$apr_config --link-ld`" 128 142 for i in $apr_link_ld; do 129 AS_IF([test ${i:0:2} = "-l"],[ SD_LIBS="$i $SD_LIBS"],130 [YAT_LD_ADD_FLAG([ SD_LDFLAGS], [$i])])143 AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"], 144 [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])]) 131 145 done 132 YAT_CPP_ADD_FLAG([SD_CPPFLAGS],[`$apr_config --includes --cppflags`]) 133 fi 146 YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`]) 147 save_CPPFLAGS=$CPPFLAGS 148 CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS" 149 AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"]) 150 CPPFLAGS=$save_CPPFLAGS 151 fi 152 AC_SUBST([APR_CPPFLAGS]) 153 AC_SUBST([APR_LDFLAGS]) 154 AC_SUBST([APR_LIBS]) 134 155 135 156 # Subversion API checks 136 157 svn_found="yes" 137 AC_ARG_WITH( svn,158 AC_ARG_WITH([svn], 138 159 [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])], 139 [ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval" 140 YAT_LD_ADD_FLAG([SD_LDFLAGS], [-L$withval/lib]) 141 YAT_CPP_ADD_FLAG([SD_CPPFLAGS], [-I$withval/include]) 142 ]) 143 144 145 146 # Use SD_*FLAGS in tests 147 CPPFLAGS="$SD_CPPFLAGS $CPPFLAGS" 148 CXXFLAGS="$SD_CXXFLAGS $CXXFLAGS" 149 LDFLAGS="$SD_LDFLAGS $LDFLAGS" 150 LIBS="$SD_LIBS $LIBS" 151 152 AC_CHECK_HEADER([apr_allocator.h],,apr_found="no") 153 AC_CHECK_HEADER([subversion-1/svn_types.h],,svn_found="no") 160 [ AS_CASE([$withval], [yes|no], 161 [AC_MSG_ERROR([--with-svn requires a directory to be provided])]) 162 AS_IF([test -d $with_svn], [], 163 [AC_MSG_ERROR([$with_svn: no such directory])]) 164 # transform argument to absolute path 165 with_svn=`cd $with_svn && pwd` 166 DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn" 167 YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$with_svn/lib]) 168 YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$with_svn/include]) 169 ]) 170 # svn needs needs apr headers 171 save_CPPFLAGS=$CPPFLAGS 172 CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS" 173 AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"]) 174 CPPFLAGS=$save_CPPFLAGS 175 176 save_LDFLAGS=$LDFLAGS 177 save_LIBS=$LIBS 178 tmp_LIBS="$APR_LIBS $save_LIBS" 179 LIBS="" 180 LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS" 154 181 AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1], 155 [SD_LIBS="-lsvn_subr-1 $SD_LIBS"],svn_found="no") 156 AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], 157 [SD_LIBS="-lsvn_ra-1 $SD_LIBS"],svn_found="no") 158 AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], 159 [SD_LIBS="-lsvn_wc-1 $SD_LIBS"],svn_found="no") 160 AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1], 161 [SD_LIBS="-lsvn_diff-1 $SD_LIBS"],svn_found="no") 162 AC_SEARCH_LIBS([svn_client_log3],[svn_client-1], 163 [SD_LIBS="-lsvn_client-1 $SD_LIBS"],svn_found="no") 164 165 # Export flags 166 AC_SUBST([SVNDIGEST_CPPFLAGS], $SD_CPPFLAGS) 167 AC_SUBST([SVNDIGEST_CXXFLAGS], $SD_CXXFLAGS) 168 AC_SUBST([SVNDIGEST_LDFLAGS], $SD_LDFLAGS) 169 AC_SUBST([SVNDIGEST_LIBS], $SD_LIBS) 170 171 # Reset FLAGS 172 CPPFLAGS="$SAVE_CPPFLAGS" 173 CXXFLAGS="$SAVE_CXXFLAGS" 174 LDFLAGS="$SAVE_LDFLAGS" 175 LIBS="$SAVE_LIBS" 182 [], [svn_found="no"], [$tmp_LIBS]) 183 AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS]) 184 AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS]) 185 AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[], 186 [svn_found="no"], [$tmp_LIBS]) 187 AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS]) 188 SVN_LIBS=$LIBS 189 LIBS=$save_LIBS 190 LDFLAGS=$save_LDFLAGS 191 AC_SUBST([SVN_CPPFLAGS]) 192 AC_SUBST([SVN_LDFLAGS]) 193 AC_SUBST([SVN_LIBS]) 194 176 195 177 196 # check if svnversion is installed 178 197 AC_PATH_PROG([SVNVERSION], [svnversion], [no]) 198 199 # PLplot API checks 200 # plplot_found can get values: skip, noheader, old, or nolib if an 201 # error is detected. 202 plplot_found="yes" 203 plplot_version=5.9 204 save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH 205 AC_ARG_WITH([plplot], 206 [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])], 207 [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval" 208 AS_IF([test "x$withval" = "xno"], [ dnl 209 plplot_found=skip; 210 ], [ dnl 211 AS_IF([test -d $with_plplot], [], 212 [AC_MSG_ERROR([$with_plplot: no such directory])]) 213 with_plplot=`cd $with_plplot && pwd` 214 # help pkg-config find .pc file 215 PKG_CONFIG_PATH=$with_plplot/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH 216 export PKG_CONFIG_PATH 217 ]) 218 ]) 219 220 use_plplot_pc="no" 221 AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [ 222 AC_MSG_CHECKING([for plplotd-c++.pc]) 223 AS_IF([$PKG_CONFIG --exists plplotd-c++], [ 224 AC_MSG_RESULT([yes]) 225 use_plplot_pc="yes" 226 ],[ 227 AC_MSG_RESULT([no]) 228 AC_MSG_WARN([cannot find plplotd-c++; 229 please use --with-plplot with appropriate argument to get more accurate 230 configuration.]) 231 ]) 232 ]) 233 234 AS_IF([test "x$plplot_found" = "xyes"], [ 235 # copy flags if we have found pc file 236 AS_IF([test "$use_plplot_pc" = "yes"], [ 237 YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`]) 238 PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`" 239 ],[ 240 # otherwise guess 241 PLPLOT_LIBS="-lplplotcxxd -lplplotd"; 242 AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [ 243 YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [-L$with_plplot/libs]) 244 ]) 245 ]) 246 # don't use `pkg-config --cflags' because it returns 247 # `PREFIX/include/plplot' rather than `PREFIX/include' 248 AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [ 249 YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [-I$with_plplot/include]) 250 ]) 251 ]) 252 253 AS_IF([test "x$plplot_found" = "xyes"], [ 254 save_CPPFLAGS=$CPPFLAGS 255 CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS" 256 AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"]) 257 CPPFLAGS=$save_CPPFLAGS 258 ]) 259 260 261 AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [ 262 AC_MSG_CHECKING([plplot version >= $plplot_version]) 263 AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [ 264 AC_MSG_RESULT([yes]) 265 ],[ 266 AC_MSG_RESULT([`$PKG_CONFIG --modversion= plplotd-c++`]) 267 plplot_found="old" 268 ]) 269 ]) 270 271 AS_IF([test "x$plplot_found" = "xyes"], [ 272 save_CPPFLAGS=$CPPFLAGS 273 CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS" 274 save_LDFLAGS=$LDFLAGS 275 LDFLAGS="$PLPLOT_LDFLAGS $LDFLAGS" 276 save_LIBS=$LIBS 277 LIBS="$PLPLOT_LIBS $LIBS" 278 AC_MSG_CHECKING([for library containing plstream]) 279 AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>], 280 [plstream pls(1,1,"svg", "conftest.svg"); 281 pls.scolbga(255, 255, 255, 0); 282 ])], 283 [AC_MSG_RESULT([yes]); 284 AC_DEFINE([HAVE_PLPLOT], [1], 285 [Define to 1 if you have plplot])], 286 [AC_MSG_RESULT([no]) 287 plplot_found=nolib;]) 288 CPPFLAGS=$save_CPPFLAGS 289 LDFLAGS=$save_LDFLAGS 290 LIBS=$save_LIBS 291 ]) 292 # restore variable 293 export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH 294 AC_SUBST(PLPLOT_CPPFLAGS) 295 AC_SUBST(PLPLOT_LDFLAGS) 296 AC_SUBST(PLPLOT_LIBS) 179 297 180 298 # checking if we build in a subversion WC … … 194 312 AC_SUBST(abs_test_repo)] 195 313 ) 196 AC_CONFIG_FILES([test/ test_repo.sh], [chmod +x test/test_repo.sh])314 AC_CONFIG_FILES([test/init.sh]) 197 315 AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh]) 198 AC_CONFIG_FILES([test/check_repo_status.sh], 199 [chmod +x test/check_repo_status.sh]) 200 316 317 dnl maintainer make rukes from yat project 318 YAT_SVN_RELEASE 319 320 # Restore FLAGS 321 APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_]) 322 APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_]) 201 323 202 324 AC_CONFIG_FILES([Makefile … … 267 389 fi 268 390 391 # Non-existing PLplot API is fatal -- sub-sequent compilation will fail. 392 AS_CASE([$plplot_found], 393 [noheader], 394 [AC_MSG_WARN([ 395 PLplot developer files cannot be found. Make sure PLplot is installed.]) 396 all_reqs_ok="false"], 397 [old], 398 [AC_MSG_WARN([ 399 PLplot developer files found but not required API version. 400 Version at least $plplot_version is required. Please upgrade PLplot.]) 401 all_reqs_ok="false"], 402 [nolib], 403 [AC_MSG_WARN([ 404 PLplot developer files found but linking against plplot library failed.]) 405 all_reqs_ok="false"]) 406 269 407 if test $ac_cv_type_long_long_int != yes ; then 270 408 AC_MSG_WARN([Compiler $CXX does not support `long long'. … … 284 422 285 423 # Some more messages. 286 AC_MSG_NOTICE([]) 287 AC_MSG_NOTICE([ Ready to compile the executables of svndigest $VERSION]) 288 AC_MSG_NOTICE([ The following flags and libs will be used:]) 289 AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) 290 AC_MSG_NOTICE([ Compiler: $CXX]) 291 AC_MSG_NOTICE([ Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS]) 292 AC_MSG_NOTICE([ C++ flags: $SD_CXXFLAGS $CXXFLAGS]) 293 AC_MSG_NOTICE([ Linker flags: $SD_LDFLAGS $LDFLAGS]) 294 AC_MSG_NOTICE([ LIBS: $SD_LIBS $LIBS]) 295 AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) 296 AC_MSG_NOTICE([]) 297 298 # Failure to locate gnuplot is not considered fatal 299 if (test "x$GNUPLOT" = "xno") ; then 300 AC_MSG_WARN([Gnuplot was not found. svndigest will compile 301 without gnuplot but will throw an exception at run-time. Please 302 install gnuplot (available for a wide range of operating systems 303 at http://www.gnuplot.info).]) 304 AC_MSG_NOTICE([]) 305 fi 306 307 AC_MSG_NOTICE([Now type 'make && make check'.]) 424 AC_MSG_NOTICE([ 425 Ready to compile the executables of svndigest $VERSION 426 The following flags and libs will be used: 427 +++++++++++++++++++++++++++++++++++++++++++++++ 428 Compiler: $CXX 429 Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS 430 CPPFLAGS: $CPPFLAGS 431 DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS 432 APR_CPPFLAGS: $APR_CPPFLAGS 433 SVN_CPPFLAGS: $SVN_CPPFLAGS 434 PLPLOT_CPPFLAGS: $PLPLOT_CPPFLAGS 435 C++ flags: 436 CXXFLAGS: $CXXFLAGS 437 DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS 438 Linker flags: 439 LDFLAGS: $LDFLAGS 440 APR_LDFLAGS: $APR_LDFLAGS 441 SVN_LDFLAGS: $SVN_LDFLAGS 442 PLPLOT_LDFLAGS: $PLPLOT_LDFLAGS 443 Libraries: 444 LIBS $LIBS 445 APR_LIBS $APR_LIBS 446 SVN_LIBS $SVN_LIBS 447 PLPLOT_LIBS $PLPLOT_LIBS 448 +++++++++++++++++++++++++++++++++++++++++++++++]dnl 449 ) 450 451 AC_MSG_NOTICE([Now type 'make all check'.]) -
branches/src-highlight/doc/readme.txt
r833 r1100 2 2 {{{ 3 3 Copyright (C) 2005 Jari Häkkinen 4 Copyright (C) 2006 Jari Häkkinen, Peter Johansson5 Copyright (C) 200 7, 2008, 2009Peter Johansson4 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 77 77 second block describes that comments also could come as `/* ... */`. 78 78 79 For a more detailed illustration, please have a look at `config` that80 can be found in directory `.svndigest`, and the svndigest screenshots81 that can be reached through http://dev.thep.lu.se/svndigest/.82 83 79 Sometimes it might be useful if a file could be parsed as though it 84 80 was going under a different name. It could, for example, be useful if … … 97 93 98 94 To avoid retrieving the same data repeatedly from the repository, 99 statistics is ca hed in files located in `.svndigest`. Subsequent95 statistics is cached in files located in `.svndigest`. Subsequent 100 96 svndigest runs read the cache files and retrieve information from the 101 97 repository only for the revisions that have been committed since the … … 143 139 inherited to the new config file. To preserve such a comment you must 144 140 merge the new config file with the old config file manually. 141 142 The color used for each author in plots and blame output can be 143 configured in section [author-color] in config file. The format of the 144 color string is a 6-digit hexadecimal number in which each color (red, 145 green and blue) is decribed by 2 digits, i.e. each color is described 146 by a value between 0 and 255 in hexadecimal format. It is also allowed 147 to set the color with a 3-digit hexadecimal number in which case, for 148 example, 'a5b' would be equivalent to 'aa55bb'. 149 150 The format of images in the report can be configured in section 151 [image]. Allowed formats are `png`, `svg`, and `none` where the latter 152 implies that images are not created. 145 153 146 154 == Copyright update == … … 198 206 * Create the plots and HTML presentation. 199 207 208 = Copy Cache = 209 210 As explained above, statistics are cached during a run and svndigest 211 only communicates with the server to retrieve statistics of the 212 activity since last run. Subsequent runs are much faster why it is 213 prefereble to run svndigest in a wc with recent cache available. 214 215 Sometimes it is useful to copy the cache from one wc to another, and 216 an easy way to do this is to use the tool `svndigest-copy-cache`, 217 which is shipped with svndigest. A common use case is when creating, 218 say, a release branch from the trunk, in which case you likely will 219 have two working copies to follow the two branches. If you want to run 220 svndigest on both of them and you want to avoid the first expensive 221 run (without cache) you can copy the cache from the trunk wc to the 222 release-branch wc. 223 224 As explained in the caching section, it is important that the cache 225 reflects a revision that belong to the history of the wc. So, for 226 example, when creating a branch it is crucial to copy the cache from 227 the trunk wc to the new branch wc before running svndigest on trunk 228 wc. Otherwise the cache will contain information about changesets that 229 were committed after the new branch were forked out. This will not 230 only be untrue as these changesets are not in the line of history of 231 the branch, but it will also cause problems for svndigest when 232 calculating the statistics of the most recent revisons and result is 233 undefined due to inconsistency between the cache and the log. For an 234 example of how `svndigest-copy-cache` may be used please refer to the 235 ReleaseProcedure of svndigest. 236 237 `svndigest-copy-cache` copies the cache file from `ROOT` tree to the 238 corresponding directory in `TARGET` tree. The tree structure of the 239 two working copies must be identical because `svndigest-copy-cache` 240 will not create any directories in `TARGET` tree except that 241 `.svndigest` directories are created when necessary. 242 243 Also, `svndigest-copy-cache` is ignorant about svn wc and will parse 244 through `ROOT` directory and all its sub-directories ,looking for 245 svndigest cache files, regardless whether they belong to the same svn 246 working copy or not. Therefore, having other svn wc in subdirectories 247 of `ROOT` might give an unexpected result. -
branches/src-highlight/lib/AddStats.cc
r803 r1100 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 5 7 6 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 75 77 76 78 79 unsigned int AddStats::max_element(const std::vector<unsigned int>& v) const 80 { 81 assert(v.size()); 82 return v.back(); 83 } 84 85 77 86 }} // end of namespace svndigest and namespace theplu -
branches/src-highlight/lib/AddStats.h
r693 r1100 5 5 6 6 /* 7 Copyright (C) 2008 Peter Johansson 7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson 8 10 9 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 43 45 private: 44 46 void do_parse(const std::string&, svn_revnum_t); 47 unsigned int max_element(const std::vector<unsigned int>&) const; 45 48 46 49 }; -
branches/src-highlight/lib/Alias.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007, 2008 Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Alias.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 9 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/BlameStats.cc
r818 r1100 3 3 /* 4 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson6 Copyright (C) 2009 Peter Johansson5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/BlameStats.h
r693 r1100 6 6 /* 7 7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006 Jari Häkkinen, Peter Johansson9 Copyright (C) 20 07Peter Johansson8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/ClassicStats.cc
r803 r1100 3 3 /* 4 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 6 7 7 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 73 74 74 75 76 unsigned int 77 ClassicStats::max_element(const std::vector<unsigned int>& v) const 78 { 79 assert(v.size()); 80 return v.back(); 81 } 82 75 83 }} // end of namespace svndigest and namespace theplu -
branches/src-highlight/lib/ClassicStats.h
r693 r1100 6 6 /* 7 7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006 Jari Häkkinen, Peter Johansson9 Copyright (C) 20 07Peter Johansson8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 45 45 private: 46 46 void do_parse(const std::string&, svn_revnum_t); 47 unsigned int max_element(const std::vector<unsigned int>&) const; 47 48 48 49 }; -
branches/src-highlight/lib/Commitment.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007, 2008 Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Commitment.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson 7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Configuration.cc
r818 r1100 2 2 3 3 /* 4 Copyright (C) 2007, 2008 Peter Johansson 5 Copyright (C) 2008 Jari Häkkinen 4 Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson 6 5 7 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 21 20 */ 22 21 22 #include <config.h> 23 23 24 #include "Configuration.h" 24 25 26 #include "Colors.h" 25 27 #include "Functor.h" 26 28 … … 61 63 62 64 65 const std::map<std::string, std::string>& 66 Configuration::author_colors(void) const 67 { 68 return author_color_; 69 } 70 63 71 std::string Configuration::author_str_color(const std::string& author) const 64 72 { … … 78 86 for (String2Codons::const_iterator i(string2codons_.begin()); 79 87 i!=string2codons_.end(); ++i) { 80 if (svndigest::equal(file_name.begin(), file_name.end(), 81 i->first.begin(), i->first.end()) ) { 88 if (fnmatch(i->first.c_str(), file_name.c_str())) 82 89 return &i->second; 83 }84 90 } 85 91 return NULL; … … 97 103 { 98 104 for (size_t i=0; i<dictionary_.size(); ++i) 99 if (svndigest::equal(lhs.begin(), lhs.end(), 100 dictionary_[i].first.begin(), 101 dictionary_[i].first.end())) 105 if (fnmatch(lhs.c_str(), dictionary_[i].first.c_str())) 102 106 return &dictionary_[i]; 103 107 return NULL; … … 119 123 120 124 125 const std::string& Configuration::image_anchor_format(void) const 126 { 127 return image_anchor_format_; 128 } 129 130 131 const std::string& Configuration::image_format(void) const 132 { 133 return image_format_; 134 } 135 136 121 137 void Configuration::load(void) 122 138 { … … 129 145 { 130 146 assert(is.good()); 131 set_default();132 147 133 148 bool parsing_found=false; … … 188 203 } 189 204 else if (section == "author-color") { 205 unsigned char r,g,b; 206 try { 207 str2rgb(rhs, r,g,b); 208 } 209 catch (std::runtime_error& e) { 210 throw Config_error(line, e.what()); 211 } 190 212 author_color_[lhs] = rhs; 191 213 } … … 203 225 for (String2Codons::const_iterator i(string2codons_.begin()); 204 226 i!=string2codons_.end(); ++i) { 205 if (svndigest::equal(lhs.begin(), lhs.end(), 206 i->first.begin(), i->first.end()) ) { 227 if (fnmatch(lhs.c_str(), i->first.c_str())) { 207 228 mess << "`" << i->first << "'"; 208 229 break; … … 269 290 } 270 291 } 292 else if (section == "image") { 293 if (lhs == "format") { 294 try { 295 image_format(rhs); 296 } 297 catch (std::runtime_error e) { 298 throw Config_error(line, 299 "unknown format: " + rhs + "\n" + e.what()); 300 } 301 } 302 else if (lhs == "image_format") { 303 try { 304 image_anchor_format(rhs); 305 } 306 catch (std::runtime_error e) { 307 throw Config_error(line, 308 "unknown format: " + rhs + "\n" + e.what()); 309 } 310 } 311 } 271 312 } 272 313 validate_dictionary(); 314 } 315 316 317 void Configuration::image_anchor_format(const std::string& format) 318 { 319 if (format!="none" && format!="pdf" && format!="png" && format!="svg") { 320 std::ostringstream oss; 321 oss << "Valid arguments are:\n" 322 << " - `none'\n" 323 << " - `pdf'\n" 324 << " - `png'\n" 325 << " - `svg'"; 326 throw std::runtime_error(oss.str()); 327 } 328 image_anchor_format_ = format; 329 } 330 331 332 void Configuration::image_format(const std::string& format) 333 { 334 if (format!="none" && format!="png" && format!="svg") { 335 std::ostringstream oss; 336 oss << "Valid arguments are:\n" 337 << " - `none'\n" 338 << " - `png'\n" 339 << " - `svg'"; 340 throw std::runtime_error(oss.str()); 341 } 342 image_format_ = format; 273 343 } 274 344 … … 294 364 const std::pair<std::string, std::string>& dic) const 295 365 { 296 assert(svndigest::equal(str.begin(), str.end(),297 dic.first.begin(), dic.first.end()));298 366 std::string res; 299 367 std::vector<std::string> vec; 300 regexp(str.begin(), str.end(), dic.first.begin(), dic.first.end(), vec); 368 if (!regexp(dic.first, str, vec)) { 369 std::stringstream mess; 370 mess << "invalid config file: " 371 << "expression " << dic.first << " is invalid"; 372 throw std::runtime_error(mess.str()); 373 } 301 374 for (std::string::const_iterator i(dic.second.begin()); 302 375 i!=dic.second.end(); ++i) { … … 307 380 if (n>vec.size() || n==0){ 308 381 std::stringstream mess; 309 mess << " svndigest:invalid config file: "382 mess << "invalid config file: " 310 383 << "expression " << dic.second << " is invalid"; 311 384 if (n) 312 385 mess << "because " << n << " is a too large."; 313 throw std::runtime_error( "");386 throw std::runtime_error(mess.str()); 314 387 } 315 388 res += vec[n-1]; … … 366 439 add_codon("*.ac", "dnl", "\n"); 367 440 add_codon("*.am", "#", "\n"); 368 add_codon("*.m4", "#", "\n"); 369 add_codon("*.m4", "dnl", "\n"); 441 add_codon("*.as", "#", "\n"); 442 add_codon("*.as", "dnl", "\n"); 443 add_codon("*.bat", "\nREM", "\n"); 444 add_codon("*.bat", "\nrem", "\n"); 370 445 add_codon("*.c", "//", "\n"); 371 446 add_codon("*.c", "/*", "*/"); … … 374 449 add_codon("*.cpp", "//", "\n"); 375 450 add_codon("*.cpp", "/*", "*/"); 451 add_codon("*.css", "<!--", "-->"); 376 452 add_codon("*.cxx", "//", "\n"); 377 453 add_codon("*.cxx", "/*", "*/"); … … 382 458 add_codon("*.hpp", "//", "\n"); 383 459 add_codon("*.hpp", "/*", "*/"); 460 add_codon("*.html", "<%--", "--%>"); 384 461 add_codon("*.java", "//", "\n"); 385 462 add_codon("*.java", "/*", "*/"); 463 add_codon("*.jsp", "<!--", "-->"); 464 add_codon("*.m", "%", "\n"); 465 add_codon("*.m4", "#", "\n"); 466 add_codon("*.m4", "dnl", "\n"); 386 467 add_codon("*.pl", "#", "\n"); 387 468 add_codon("*.pm", "#", "\n"); 469 add_codon("*.R", "#", "\n"); 470 add_codon("*.rss", "<!--", "-->"); 471 add_codon("*.sgml", "<!--", "-->"); 388 472 add_codon("*.sh", "#", "\n"); 473 add_codon("*.shtml", "<!--", "-->"); 474 add_codon("*.tex", "%", "\n"); 475 add_codon("*.xhtml", "<!--", "-->"); 476 add_codon("*.xml", "<!--", "-->"); 477 add_codon("*.xsd", "<!--", "-->"); 478 add_codon("*.xsl", "<!--", "-->"); 389 479 add_codon("*config", "#", "\n"); 390 480 add_codon("bootstrap", "#", "\n"); 391 481 add_codon("Makefile", "#", "\n"); 392 add_codon("*.tex", "%", "\n");393 add_codon("*.m", "%", "\n");394 add_codon("*.jsp", "<!--", "-->");395 add_codon("*.html", "<%--", "--%>");396 add_codon("*.xml", "<!--", "-->");397 add_codon("*.xsl", "<!--", "-->");398 add_codon("*.xsd", "<!--", "-->");399 add_codon("*.xhtml", "<!--", "-->");400 add_codon("*.shtml", "<!--", "-->");401 add_codon("*.xml", "<!--", "-->");402 add_codon("*.css", "<!--", "-->");403 add_codon("*.rss", "<!--", "-->");404 add_codon("*.sgml", "<!--", "-->");405 add_codon("*.bat", "\nREM", "\n");406 add_codon("*.bat", "\nrem", "\n");407 482 408 483 dictionary_ = VectorPair(1, std::make_pair("*.in", "$1")); 484 image_format_ = "png"; 485 image_anchor_format_ = "png"; 409 486 } 410 487 … … 463 540 464 541 for (vector::const_iterator i(vec.begin()); i!=vec.end(); ++i) { 465 os << i->first << " = " << i->second.name() << " 542 os << i->first << " = " << i->second.name() << "\n"; 466 543 } 467 544 468 545 os << "\n" 469 << "### Section for author color in blame output\n" 546 << "### Section for images\n" 547 << "[image]\n" 548 << "format = " << conf.image_format() << "\n"; 549 os << "anchor_format = " << conf.image_anchor_format() << "\n"; 550 551 552 os << "\n" 553 << "### Section for author color in plots and blame output.\n" 470 554 << "[author-color]\n" 471 555 << "# jdoe = 000000\n"; … … 473 557 for (str_map::const_iterator i(conf.author_color_.begin()); 474 558 i!=conf.author_color_.end(); ++i) { 475 os << i->first << " = " << i->second << " 559 os << i->first << " = " << i->second << "\n"; 476 560 } 477 561 -
branches/src-highlight/lib/Configuration.h
r815 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson 7 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2010 Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 45 46 46 47 /** 47 \return hexadecimal color code (e.g. 5aee4a) that is used in48 blame output . If no color is configured for \a author, an empty49 string is returned.48 \return Hexadecimal color code (e.g. 5aee4a) that is used in 49 blame output and as line colors in plots. If no color is 50 configured for \a author, an empty string is returned. 50 51 */ 51 52 std::string author_str_color(const std::string& author) const; 53 54 /** 55 The map to lookup the author-color mapping set in the 56 configuration file. The color code is a six digit hexadecimal 57 number rrggbb. 58 59 \return The author-color map 60 */ 61 const std::map<std::string, std::string>& author_colors(void) const; 52 62 53 63 /** … … 61 71 /// 62 72 const std::map<std::string, Alias>& copyright_alias(void) const; 73 74 /** 75 \return pdf, png, none, or svg 76 */ 77 const std::string& image_anchor_format(void) const; 78 79 /** 80 \brief set image_anchor_format 81 */ 82 void image_anchor_format(const std::string&); 83 84 /** 85 \return png, none, svg, or svgz 86 */ 87 const std::string& image_format(void) const; 88 89 /** 90 \brief set image_format 91 */ 92 void image_format(const std::string&); 63 93 64 94 /// … … 111 141 Translate string \a str using dictionary \a dict 112 142 113 \note \a str must be equal to d.first (see function equal),143 \note \a str must be equal to d.first (see regexp(5)), 114 144 or behavior is unspecified. 115 145 … … 134 164 135 165 VectorPair dictionary_; 136 166 std::string image_anchor_format_; 167 std::string image_format_; 137 168 std::string trac_root_; 138 169 }; -
branches/src-highlight/lib/Date.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Peter Johansson 5 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 5 Copyright (C) 2009 Peter Johansson 7 6 -
branches/src-highlight/lib/Date.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 9 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Directory.cc
r834 r1100 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, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson 6 5 7 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 23 25 24 #include "Alias.h" 25 #include "Configuration.h" 26 26 #include "File.h" 27 27 #include "html_utility.h" … … 39 39 #include <list> 40 40 #include <map> 41 #include <sstream> 41 42 42 43 #include <cerrno> // Needed to check error state below. … … 148 149 void Directory::print_core(const bool verbose) const 149 150 { 150 mkdir("blame_output/" + local_path _);151 mkdir("blame_output/" + local_path()); 151 152 // print daughter nodes 152 153 for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i) … … 162 163 163 164 const Stats& stats = stats_[stats_type]; 164 std::string outdir = stats_type+"/"+user+"/"+line_type+"/"+local_path_; 165 if (local_path_=="") 166 outdir = stats_type+"/"+user+"/"+line_type; 167 165 std::string imagedir = stats_type+"/"+"images/"+line_type; 166 std::string outdir = stats_type+"/"+user+"/" +line_type; 167 if (local_path()!="") { 168 imagedir += "/"+local_path(); 169 outdir += "/"+local_path(); 170 } 168 171 mkdir(outdir); 169 std::string imagedir = stats_type+"/"+"images/"+line_type+"/"+local_path_;170 172 if (user=="all") 171 173 mkdir(imagedir); … … 180 182 local_path()+"/index.html", stats_type); 181 183 path_anchor(os); 182 os << "<p class=\"plot\">\n<img src='"; 184 185 std::stringstream ss; 183 186 for (size_t i=0; i<level_; ++i) 184 os << "../";185 os << "../../../";187 ss << "../"; 188 ss << "../../../"; 186 189 if (user=="all") 187 os << stats.plot(imagedir+"/index.png", line_type);190 ss << stats.plot(imagedir+"/index", line_type); 188 191 else 189 os << imagedir << "/index.png"; 190 os << "' alt='[plot]' /></p>\n"; 192 ss << imagedir << "/index"; 193 os << "<p class=\"plot\">\n"; 194 os << image(ss.str()); 195 os << "</p>\n"; 196 191 197 os << "<h3>File Summary"; 192 198 if (user!="all") -
branches/src-highlight/lib/Directory.h
r834 r1100 5 5 6 6 /* 7 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson7 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 Copyright (C) 2009 Peter Johansson 9 9 -
branches/src-highlight/lib/File.cc
r834 r1100 2 2 3 3 /* 4 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson5 Copyright (C) 20 09Peter Johansson4 Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 24 25 25 #include "Alias.h" 26 #include "Colors.h" 26 27 #include "Configuration.h" 27 28 #include "Date.h" 28 #include "G nuplotFE.h"29 #include "Graph.h" 29 30 #include "html_utility.h" 30 31 #include "HtmlStream.h" … … 42 43 #include <stdexcept> 43 44 #include <string> 45 #include <sstream> 44 46 #include <sys/stat.h> 45 47 … … 82 84 ++rev_iter; 83 85 } 86 // do not go beyond BASE rev of file 87 last_rev_this_year = std::min(last_rev_this_year, last_changed_rev()); 88 last_rev_last_year = std::min(last_rev_last_year, last_changed_rev()); 84 89 // loop over authors 85 90 for (std::set<std::string>::const_iterator a_iter=stats.authors().begin(); … … 103 108 Alias a(*a_iter,alias.size()); 104 109 year_authors[rev_iter->first].insert(a); 105 std::cerr << "svn digest: warning: no copyright alias found for `"110 std::cerr << "svncopyright: warning: no copyright alias found for `" 106 111 << *a_iter << "'\n"; 107 112 // insert alias to avoid multiple warnings. … … 258 263 int first=0; 259 264 bool using_dates=true; 260 if ( GnuplotFE::instance()->dates().empty()){265 if (!Graph::date_xticks()) { 261 266 using_dates=false; 262 267 last = stats_["classic"].revision(); 263 268 } 264 269 else { 265 last = Date(G nuplotFE::instance()->dates().back()).seconds();270 last = Date(Graph::xticks().back()).seconds(); 266 271 // earliest date corresponds either to revision 0 or revision 1 267 first = std::min(Date(G nuplotFE::instance()->dates()[0]).seconds(),268 Date(G nuplotFE::instance()->dates()[1]).seconds());272 first = std::min(Date(Graph::xticks()[0]).seconds(), 273 Date(Graph::xticks()[1]).seconds()); 269 274 } 270 275 // color is calculated linearly on time, c = kt + m … … 287 292 hs << Date(blame.date())("%d %b %y"); 288 293 os << "</font></td>\n<td class=\"author\">"; 289 std::stringauthor_color =290 Co nfiguration::instance().author_str_color(blame.author());291 if (!author_color.empty())292 294 const std::string& author_color = 295 Colors::instance().color_str(blame.author()); 296 assert(!author_color.empty()); 297 os << "<font color=\"#" << author_color << "\">"; 293 298 hs << blame.author(); 294 299 os << "</td>\n<td class=\""; … … 330 335 if (!detect_copyright(old_block, start_line, end_line, prefix)){ 331 336 if (Configuration::instance().missing_copyright_warning()) 332 std::cerr << "svn digest: warning: no copyright statement found in `"337 std::cerr << "svncopyright: warning: no copyright statement found in `" 333 338 << path_ << "'\n"; 334 339 return; … … 363 368 lpath = "index"; 364 369 std::string outpath = stats_type+"/"+user+"/"+line_type+"/"+lpath; 365 std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+ 366 lpath+".png"; 370 std::string imagefile = stats_type+"/"+"images/"+line_type+"/"+lpath; 367 371 std::string html_name(outpath + ".html"); 368 372 std::ofstream os(html_name.c_str()); … … 370 374 stats_type); 371 375 path_anchor(os); 372 os << "<p class=\"plot\">\n<img src='"; 376 377 std::stringstream ss; 373 378 for (size_t i=0; i<level_; ++i) 374 os << "../";375 os << "../../../";379 ss << "../"; 380 ss << "../../../"; 376 381 if (user=="all") 377 os << stats_[stats_type].plot(imagefile,line_type);382 ss << stats_[stats_type].plot(imagefile,line_type); 378 383 else 379 os << imagefile; 380 os << "' alt='[plot]' />\n</p>"; 384 ss << imagefile; 385 os << "<p class=\"plot\">\n"; 386 os << image(ss.str()); 387 os << "</p>\n"; 381 388 382 389 print_author_summary(os, stats_[stats_type], line_type, log); … … 443 450 catch (std::runtime_error e) { 444 451 // catch exception, cleanup, and rethrow 445 std::cerr << "svn digest: File::print_copyright: Exception caught, "452 std::cerr << "svncopyright: File::print_copyright: Exception caught, " 446 453 << "removing temporary file " << tmpname << std::endl; 447 454 if (unlink(tmpname)) -
branches/src-highlight/lib/File.h
r834 r1100 5 5 6 6 /* 7 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson7 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 Copyright (C) 2009 Peter Johansson 9 9 -
branches/src-highlight/lib/Functor.cc
r693 r1100 2 2 3 3 /* 4 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson4 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Functor.h
r727 r1100 5 5 6 6 /* 7 Copyright (C) 2005 , 2006, 2007 Jari Häkkinen,Peter Johansson8 Copyright (C) 200 8 Jari Häkkinen7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/HtmlBuf.cc
r693 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Jari Häkkinen, Peter Johansson5 Copyright (C) 200 8Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 33 33 : std::streambuf(), buf_(buf) 34 34 { 35 map_['"']=std::string(" \"");35 map_['"']=std::string("""); 36 36 map_['\'']=std::string("\'"); 37 37 map_['\n']=std::string("<br />"); … … 42 42 // This should be configurable, but for now indentation is two spaces. 43 43 map_['\t']=std::string(" "); 44 map_['å']=std::string("å");45 map_['ä']=std::string("ä");46 map_['ö']=std::string("ö");47 map_['Å']=std::string("Å");48 map_['Ä']=std::string("Ä");49 map_['Ö']=std::string("Ö");50 map_['é']=std::string("é");51 map_['É']=std::string("É");52 map_['á']=std::string("á");53 map_['Á']=std::string("Á");54 44 } 55 45 -
branches/src-highlight/lib/HtmlBuf.h
r693 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 9 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/HtmlStream.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2008 Peter Johansson 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 5 7 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/HtmlStream.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 9 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/LineTypeParser.cc
r693 r1100 2 2 3 3 /* 4 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 4 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 40 41 : mode_(0), post_copyright_(false), copyright_found_(false) 41 42 { 42 codon_ = Configuration::instance().codon( path);43 codon_ = Configuration::instance().codon(file_name(path)); 43 44 } 44 45 -
branches/src-highlight/lib/LineTypeParser.h
r802 r1100 5 5 6 6 /* 7 Copyright (C) 2006 Jari Häkkinen, Peter Johansson8 Copyright (C) 200 7, 2009 Peter Johansson7 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Makefile.am
r838 r1100 4 4 5 5 # Copyright (C) 2005 Jari Häkkinen 6 # Copyright (C) 2006 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2007, 2008 Peter Johansson 8 # Copyright (C) 2008 Jari Häkkinen, Peter Johansson 9 # Copyright (C) 2009 Peter Johansson 6 # Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2010 Peter Johansson 10 8 # 11 9 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 29 27 SUBDIRS = yat . 30 28 31 AM_CPPFLAGS = $(SVNDIGEST_CPPFLAGS) 32 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 29 AM_CPPFLAGS = $(DEFAULT_CPPFLAGS) $(APR_CPPFLAGS) $(SVN_CPPFLAGS) \ 30 $(PLPLOT_CPPFLAGS) 31 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS) 33 32 34 33 noinst_LIBRARIES = libsvndigest.a 35 34 36 35 noinst_HEADERS = AddStats.h Alias.h BlameStats.h ClassicStats.h \ 37 Co mmitment.h Configuration.h copyright_year.h css.h\36 Colors.h Commitment.h Configuration.h css.h \ 38 37 Date.h Directory.h File.h first_page.h Functor.h \ 39 G nuplot.h GnuplotFE.h \38 Graph.h \ 40 39 HtmlBuf.h HtmlStream.h html_utility.h LineTypeParser.h \ 41 Node.h40 main_utility.h Node.h \ 42 41 OptionVersion.h rmdirhier.h \ 43 42 Stats.h StatsCollection.h subversion_info.h SVN.h SVNblame.h \ … … 45 44 46 45 libsvndigest_a_SOURCES = AddStats.cc Alias.cc BlameStats.cc \ 47 ClassicStats.cc \48 Commitment.cc Configuration.cc copyright_year.cc\46 ClassicStats.cc Colors.cc \ 47 Commitment.cc Configuration.cc \ 49 48 css.cc Date.cc Directory.cc File.cc first_page.cc\ 50 Functor.cc G nuplot.cc GnuplotFE.ccHtmlBuf.cc HtmlStream.cc \51 html_utility.cc LineTypeParser.cc Node.cc \49 Functor.cc Graph.cc HtmlBuf.cc HtmlStream.cc \ 50 html_utility.cc LineTypeParser.cc main_utility.cc Node.cc \ 52 51 OptionVersion.cc \ 53 52 rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc \ … … 72 71 $(srcdir)/subversion_info.cc.in >> $@ ; 73 72 74 # update copyright year automatically (if we build from svn wc)75 $(srcdir)/copyright_year.cc: copyright_year.cc.tmp76 @$(MOVE_IF_CHANGE) copyright_year.cc.tmp $@77 78 copyright_year.cc.tmp: FORCE79 @if (echo $(SVN_REVISION) | $(GREP) M); then \80 $(SED) -e 's/"20[0-9][0-9]"/'\"`date -u "+%Y"`\"'/g' \81 $(srcdir)/copyright_year.cc > $@ ; \82 else \83 cp $(srcdir)/copyright_year.cc $@; \84 fi85 86 73 else 87 74 # this is needed in 'svn export' build -
branches/src-highlight/lib/Node.cc
r834 r1100 2 2 3 3 /* 4 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2008 Jari Häkkinen 4 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 5 Copyright (C) 2009 Peter Johansson 7 6 -
branches/src-highlight/lib/Node.h
r834 r1100 5 5 6 6 /* 7 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson7 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 8 Copyright (C) 2009 Peter Johansson 9 Copyright (C) 2010 Jari Häkkinen 9 10 10 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 208 209 209 210 unsigned int level_; 210 std::string local_path_; // path from root211 211 std::string output_dir_; 212 212 std::string path_; // absolute path … … 235 235 bool binary_; 236 236 bool link_; 237 std::string local_path_; // path from root 237 238 mutable SVNlog* log_; 238 239 bool svndigest_ignore_; -
branches/src-highlight/lib/OptionVersion.cc
r795 r1100 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson4 Copyright (C) 2008, 2009, 2010 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 22 22 #include <config.h> 23 23 24 #include "copyright_year.h"25 24 #include "OptionVersion.h" 26 25 #include "subversion_info.h" … … 34 33 #include <apr_version.h> 35 34 35 #include <cstdlib> 36 #include <iostream> 36 37 #include <sstream> 37 38 #include <string> … … 52 53 yat::utility::ColumnStream cs(std::cout, 1); 53 54 cs.width(0)=79; 54 cs << PACKAGE_NAME<< " " << PACKAGE_VERSION;55 cs << prog_name_ << " " << PACKAGE_VERSION; 55 56 bool no_verbose = verbose_ && verbose_->present() && !verbose_->value(); 56 57 if (!no_verbose) { … … 61 62 << ")"; 62 63 } 63 cs << "\n\nCopyright (C) " << svn_year()64 cs << "\n\nCopyright (C) " << RELEASE_YEAR 64 65 << " Jari H\u00E4kkinen and Peter Johansson.\n" 65 66 << "This is free software. You may redistribute copies of it under " … … 78 79 cs << apr_version_string(); 79 80 cs << "\n"; 81 cs << extra_; 80 82 } 81 exit(0); 83 exit(EXIT_SUCCESS); 84 } 85 86 87 void OptionVersion::extra(const std::string& str) 88 { 89 extra_ = str; 90 } 91 92 93 void OptionVersion::program_name(const std::string& str) 94 { 95 prog_name_ = str; 82 96 } 83 97 -
branches/src-highlight/lib/OptionVersion.h
r795 r1100 5 5 6 6 /* 7 Copyright (C) 2008 Peter Johansson7 Copyright (C) 2008, 2009, 2010 Peter Johansson 8 8 9 This file is part of svndigest, http:// trac.thep.lu.se/svndigest9 This file is part of svndigest, http://dev.thep.lu.se/svndigest 10 10 11 11 svndigest is free software; you can redistribute it and/or modify it … … 57 57 OptionSwitch* const verbose=NULL); 58 58 59 /** 60 add extra string appended to output 61 */ 62 void extra(const std::string&); 63 64 /** 65 set program name 66 */ 67 void program_name(const std::string&); 68 69 /** 70 \brief set version string 71 */ 72 void version(const std::string&); 73 59 74 private: 60 75 OptionSwitch* const verbose_; 61 76 std::string extra_; 77 std::string prog_name_; 62 78 63 79 /** -
branches/src-highlight/lib/SVN.cc
r693 r1100 3 3 /* 4 4 Copyright (C) 2006 Jari Häkkinen 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2008 Peter Johansson 5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 7 6 8 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVN.h
r800 r1100 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen 8 Copyright (C) 2007 Jari Häkkinen, Peter Johansson9 Copyright (C) 200 8Peter Johansson8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2009 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNblame.cc
r768 r1100 3 3 /* 4 4 Copyright (C) 2006 Jari Häkkinen 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2008 Peter Johansson 5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 7 6 8 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNblame.h
r768 r1100 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen 8 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2008 Peter Johansson 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 10 9 11 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNinfo.cc
r768 r1100 3 3 /* 4 4 Copyright (C) 2006 Jari Häkkinen 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2008 Peter Johansson 5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 7 6 8 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNinfo.h
r768 r1100 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen 8 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2008 Peter Johansson 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 10 9 11 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 109 108 /// @see Subversion API documentation 110 109 /// 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 110 static svn_error_t * info_receiver(void *baton, const char *path, 115 111 const svn_info_t *info, apr_pool_t *pool); -
branches/src-highlight/lib/SVNlog.cc
r768 r1100 3 3 /* 4 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNlog.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007 Jari Häkkinen, Peter Johansson8 Copyright (C) 200 8Peter Johansson7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 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/src-highlight/lib/SVNproperty.cc
r768 r1100 3 3 /* 4 4 Copyright (C) 2006 Jari Häkkinen 5 Copyright (C) 2007, 2008 Peter Johansson5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/SVNproperty.h
r768 r1100 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen 8 Copyright (C) 2007, 2008 Peter Johansson8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Stats.cc
r803 r1100 3 3 /* 4 4 Copyright (C) 2005 Peter Johansson 5 Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson6 Copyright (C) 20 08, 2009Peter Johansson5 Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2010 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 24 24 #include "Stats.h" 25 25 26 #include "Colors.h" 27 #include "Configuration.h" 26 28 #include "Functor.h" 27 #include "G nuplotFE.h"29 #include "Graph.h" 28 30 #include "SVNblame.h" 29 31 #include "SVNinfo.h" … … 278 280 std::string str; 279 281 getline(is, str); 280 if (str!=cache_check_str()) 282 if (str!=cache_check_str()) { 283 if (str == prev_cache_check_str()) 284 std::cout << "cache file is obsolete; " 285 << "retrieving statistics from repository.\n"; 281 286 return 0; 287 } 282 288 svn_revnum_t rev; 283 289 is >> rev; … … 331 337 332 338 339 unsigned int Stats::max_element(const std::vector<unsigned int>& vec) const 340 { 341 return *std::max_element(vec.begin(), vec.end()); 342 } 343 344 333 345 void Stats::parse(const std::string& path, svn_revnum_t rev) 334 346 { … … 349 361 } 350 362 363 351 364 std::string Stats::plot(const std::string& filename, 352 365 const std::string& linetype) const 353 366 { 367 const std::string& format = Configuration::instance().image_format(); 368 if (format=="none") 369 return filename; 370 plot(filename, linetype, format); 371 const std::string& anchor_format = 372 Configuration::instance().image_anchor_format(); 373 374 if (format!=anchor_format) 375 plot(filename, linetype, anchor_format); 376 return filename; 377 } 378 379 380 void Stats::plot(const std::string& filename, 381 const std::string& linetype, 382 const std::string& format) const 383 { 354 384 assert(total_stats().size()); 355 plot_init(filename); 356 GnuplotFE* gp=GnuplotFE::instance(); 385 Graph gp(filename+"."+format, format); 357 386 const Author2Vector* stat=NULL; 358 387 if (linetype=="total") … … 368 397 assert(stat->find("all")!=stat->end()); 369 398 std::vector<unsigned int> total=get_vector(*stat, "all"); 370 double yrange_max=1.03 *total.back()+1;371 gp ->yrange(yrange_max);399 double yrange_max=1.03 * max_element(total) +1.0; 400 gp.ymax(yrange_max); 372 401 373 402 typedef std::vector<std::pair<std::string, std::vector<unsigned int> > > vec_type; … … 376 405 for (std::set<std::string>::const_iterator i=authors_.begin(); 377 406 i != authors_.end(); ++i) { 378 if (lines(*i)) { 379 assert(stat->find(*i)!=stat->end()); 380 author_cont.push_back(std::make_pair(*i,get_vector(*stat,*i))); 407 assert(stat->find(*i)!=stat->end()); 408 const std::vector<unsigned int>& vec = get_vector(*stat,*i); 409 if (max_element(vec)) { 410 author_cont.push_back(std::make_pair(*i,vec)); 381 411 } 382 412 } … … 387 417 std::sort(author_cont.begin(), author_cont.end(), compare); 388 418 389 size_t plotno=author_cont.size();390 std::stringstream ss;391 419 vec_type::iterator end(author_cont.end()); 392 for (vec_type::iterator i(author_cont.begin()); i!=end; ++i) { 393 ss.str(""); 394 ss << "set key height " << 2*plotno; 395 gp->command(ss.str()); 396 ss.str(""); 397 ss << get_back(*stat, i->first) << " " << i->first; 398 gp->yrange(yrange_max); 399 gp->linetitle(ss.str()); 400 ss.str(""); 401 ss << "steps " << --plotno+2; 402 gp->linestyle(ss.str()); 403 gp->plot(i->second); 404 } 405 ss.str(""); 406 ss << get_back(*stat, "all") << " total"; 407 gp->command("set key height 0"); 408 gp->linetitle(ss.str()); 409 gp->linestyle("steps 1"); 410 gp->plot(total); 411 412 gp->command("unset multiplot"); 413 gp->yrange(); 414 415 return filename; 416 } 417 418 419 void Stats::plot_init(const std::string& filename) const 420 { 421 GnuplotFE* gp=GnuplotFE::instance(); 422 gp->command("set term png"); 423 gp->command("set output '"+filename+"'"); 424 gp->command("set xtics nomirror"); 425 gp->command("set ytics nomirror"); 426 gp->command("set key default"); 427 gp->command("set key left Left reverse"); 428 gp->command("set multiplot"); 420 vec_type::iterator i(author_cont.begin()); 421 const vec_type::size_type maxauthors=8; 422 int authskip=author_cont.size()-maxauthors; 423 if (authskip>1) { 424 // only use others if there is more than 1 author to be skipped, 425 // there is no reason to add only 1 author to others. 426 vec_type::iterator j(i); 427 i+=authskip; 428 std::vector<unsigned int> init(revision()+1); 429 std::vector<unsigned int> others = 430 std::accumulate(j, i, init, PairValuePlus<std::string,unsigned int>()); 431 unsigned char r, g, b; 432 std::string label("others"); 433 Colors::instance().get_color(label, r,g,b); 434 gp.current_color(r,g,b); 435 gp.plot(others, label, others.back()); 436 } 437 for ( ; i!=end; ++i) { 438 unsigned char r, g, b; 439 Colors::instance().get_color(i->first,r,g,b); 440 gp.current_color(r,g,b); 441 gp.plot(i->second, i->first, get_back(*stat, i->first)); 442 } 443 gp.current_color(255,0,0); 444 gp.plot(total, "total", get_back(*stat, "all")); 429 445 } 430 446 … … 432 448 void Stats::plot_summary(const std::string& filename) const 433 449 { 434 plot_init(filename); 435 GnuplotFE* gp=GnuplotFE::instance(); 450 const std::string& format = Configuration::instance().image_format(); 451 if (format=="none") 452 return; 453 plot_summary(filename, format); 454 const std::string& anchor_format = 455 Configuration::instance().image_anchor_format(); 456 457 if (format!=anchor_format) 458 plot_summary(filename, anchor_format); 459 } 460 461 462 void Stats::plot_summary(const std::string& filename, 463 const std::string& format) const 464 { 465 Graph gp(filename+"."+format, format); 436 466 std::vector<unsigned int> total = get_vector(total_stats(), "all"); 437 467 double yrange_max=1.03*total.back()+1; 438 gp->yrange(yrange_max); 439 std::stringstream ss; 468 gp.ymax(yrange_max); 440 469 441 ss.str("");442 470 std::vector<unsigned int> x(get_vector(code_stats(), "all")); 443 ss << x.back() << " code"; 444 gp->command("set key height 2"); 445 gp->linetitle(ss.str()); 446 gp->linestyle("steps 2"); 447 gp->plot(x); 448 449 ss.str(""); 471 gp.current_color(255,255,0); 472 gp.plot(x, "code", x.back()); 473 450 474 x = get_vector(comment_or_copy_stats(), "all"); 451 ss << x.back() << " comment"; 452 gp->command("set key height 4"); 453 gp->linetitle(ss.str()); 454 gp->linestyle("steps 3"); 455 gp->plot(x); 456 457 ss.str(""); 475 gp.current_color(0,0,255); 476 gp.plot(x, "comment", x.back()); 477 458 478 x = get_vector(other_stats(), "all"); 459 ss << x.back() << " other"; 460 gp->command("set key height 6"); 461 gp->linetitle(ss.str()); 462 gp->linestyle("steps 4"); 463 gp->plot(x); 464 465 ss.str(""); 466 ss << total.back() << " total"; 467 gp->command("set key height 0"); 468 gp->linetitle(ss.str()); 469 gp->linestyle("steps 1"); 470 gp->plot(total); 471 472 gp->command("unset multiplot"); 473 gp->yrange(); 479 gp.current_color(0,255,0); 480 gp.plot(x, "other", x.back()); 481 482 gp.current_color(255,0,0); 483 gp.plot(total, "total", total.back()); 474 484 } 475 485 -
branches/src-highlight/lib/Stats.h
r768 r1100 6 6 /* 7 7 Copyright (C) 2005 Peter Johansson 8 Copyright (C) 2006 Jari Häkkinen, Peter Johansson9 Copyright (C) 20 07, 2008Peter Johansson8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 192 192 Author2Vector& map); 193 193 194 ///195 /// Init statistics graph.196 ///197 void plot_init(const std::string& output) const;198 199 194 std::set<std::string> authors_; 200 195 … … 221 216 virtual void do_parse(const std::string&, svn_revnum_t first_rev)=0; 222 217 218 /** 219 called from plot(2) 220 */ 221 void plot(const std::string& basename, const std::string& linetype, 222 const std::string& format) const; 223 224 /** 225 called from plot_summary(1) 226 */ 227 void plot_summary(const std::string& basename, 228 const std::string& format) const; 229 223 230 // Change this string if cache format is changed in such a way 224 231 // that all old cache files are obsolete. 225 232 inline std::string cache_check_str(void) const 233 {return "CACHE FILE VERSION 7";} 234 235 inline std::string prev_cache_check_str(void) const 226 236 {return "CACHE FILE VERSION 6";} 227 237 … … 231 241 unsigned int get_back(const Author2Vector&, std::string user) const; 232 242 void load(std::istream& is, Author2Vector& m); 243 /** 244 Finds the largets element by iterating through the entire 245 vector. Inherited classes should implement their own version 246 when it is possible to get the largest element in faster than 247 in linear time. 248 249 \return the largest largest element in \a v. 250 */ 251 virtual unsigned int max_element(const std::vector<unsigned int>& v) const; 252 233 253 void print(std::ostream& os, const Author2Vector& m) const; 234 254 -
branches/src-highlight/lib/StatsCollection.cc
r803 r1100 3 3 /* 4 4 Copyright (C) 2007 Peter Johansson 5 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 5 7 6 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 49 51 StatsCollection::~StatsCollection(void) 50 52 { 51 for (map:: const_iterator i(stats_.begin()); i!=stats_.end(); ++i) {53 for (map::iterator i(stats_.begin()); i!=stats_.end(); ++i) { 52 54 assert(i->second); 53 55 delete i->second; 56 i->second = NULL; 54 57 } 55 56 58 } 57 59 -
branches/src-highlight/lib/StatsCollection.h
r801 r1100 5 5 6 6 /* 7 Copyright (C) 2005 Peter Johansson8 Copyright (C) 2006 Jari Häkkinen, Peter Johansson9 7 Copyright (C) 2007 Peter Johansson 8 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 87 87 88 88 private: 89 // copy not allowed 90 StatsCollection(const StatsCollection&); 91 StatsCollection& operator=(const StatsCollection&); 92 89 93 const std::string path_; 90 94 typedef std::map<std::string, Stats*> map; -
branches/src-highlight/lib/Trac.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Jari Häkkinen, Peter Johansson5 Copyright (C) 200 8, 2009 Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/Trac.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008, 2009 Peter Johansson 7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/css.cc
r832 r1100 3 3 /* 4 4 Copyright (C) 2006 Peter Johansson 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson6 Copyright (C) 2009 Peter Johansson5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 37 37 38 38 << "Copyright (C) 2006 Peter Johansson\n" 39 << "Copyright (C) 2007 Jari Häkkinen, Peter Johansson\n"39 << "Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson\n" 40 40 << "Copyright (C) 2009 Peter Johansson\n" 41 41 << "\nThis file is part of svndigest, " … … 146 146 s << " padding: 0 1em .1em 0;\n"; 147 147 s << "}\n\n"; 148 148 s << "div.main img { border: 0; }\n"; 149 149 150 150 s << "p.plot { text-align: center; }\n"; -
branches/src-highlight/lib/css.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2006, 2007, 2008 Peter Johansson 7 Copyright (C) 2006 Peter Johansson 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/first_page.cc
r759 r1100 3 3 /* 4 4 Copyright (C) 2006 Peter Johansson 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson6 Copyright (C) 20 09Peter Johansson5 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2010 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 93 93 << "</th></tr></thead>\n" 94 94 << "<tbody>\n" 95 << "<tr><td>URL:</td><td>" 96 << url << "</td></tr>\n" 95 << "<tr><td>URL:</td><td>"; 96 if (url.size()>=4 && url.substr(0,4)=="http") 97 os << anchor(url, url); 98 else 99 os << url; 100 os << "</td></tr>\n" 97 101 << "<tr><td>First Revision Date:</td><td>" 98 102 << begin(timefmt) << "</td></tr>\n" … … 149 153 << 100*stats.comments(i->author())/(stats.comments()?stats.comments():1) 150 154 << "%)</td><td>"; 151 hs << Date(i->date())(timefmt); 155 std::string date = Date(i->date())(timefmt); 156 const Configuration& conf = Configuration::instance(); 157 if (conf.trac_root().empty()) 158 hs << date; 159 else { 160 std::stringstream url; 161 url << conf.trac_root() << "changeset/" << i->revision(); 162 os << anchor(url.str(), date); 163 } 152 164 os << "</td>" <<"</tr>"; 153 165 } … … 226 238 void print_summary_plot(std::ostream& os, const Stats& stats) 227 239 { 228 std::string name("summary_plot .png");240 std::string name("summary_plot"); 229 241 stats.plot_summary(name); 230 242 os << "<div class=\"main\">\n"; 231 os << "<img src='" << name << "' alt='[plot]'/>";243 os << image(name); 232 244 os << "</div>"; 245 246 233 247 } 234 248 -
branches/src-highlight/lib/first_page.h
r768 r1100 5 5 6 6 /* 7 Copyright (C) 2006, 2007, 2008 Peter Johansson 7 Copyright (C) 2006 Peter Johansson 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/html_utility.cc
r751 r1100 3 3 /* 4 4 Copyright (C) 2006 Peter Johansson 5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson6 Copyright (C) 2009 Peter Johansson5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2009, 2010 Peter Johansson 7 7 8 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 31 31 #include "subversion_info.h" 32 32 33 #include <cassert> 33 34 #include <sstream> 34 35 #include <string> … … 61 62 62 63 64 std::string image(const std::string& name) 65 { 66 std::ostringstream os; 67 const std::string& format = Configuration::instance().image_format(); 68 const std::string& anchor_format = 69 Configuration::instance().image_anchor_format(); 70 if (format=="svg") { 71 os << "<object data='" << name << ".svg' type='image/svg+xml'" 72 << " width='600'>\n" 73 << "<embed src='" << name << ".svg' type='image/svg+xml'" 74 << " width='600' />\n" 75 << "</object>\n"; 76 if (anchor_format != "svg") 77 std::cerr << "svndigest: anchor_format: " << anchor_format 78 << " not supported with format " << format << "\n"; 79 } 80 else if (format=="png") { 81 if (anchor_format=="none") 82 os << "<img src='" << name << ".png' alt='[plot]'/>"; 83 else 84 os << "<a href=\"" << name << "." << anchor_format << "\">" 85 << "<img src='" << name << ".png' alt='[plot]'/>" 86 << "</a>"; 87 } 88 else if (format=="none") 89 os << "<!-- no images -->"; 90 else { 91 assert(false); 92 throw std::runtime_error("unknown image format: " + format); 93 } 94 return os.str(); 95 } 96 97 63 98 void print_footer(std::ostream& os) 64 99 { … … 67 102 os << "<p class=\"footer\">\nGenerated on "; 68 103 hs << date("%a %b %e %H:%M:%S %Y") << " (UTC) by "; 69 os << anchor("http://dev.thep.lu.se/svndigest/", 70 PACKAGE_STRING, 0, ""); 104 os << anchor(PACKAGE_URL, PACKAGE_STRING, 0, ""); 71 105 if (DEV_BUILD) 72 106 os << " (dev build " << svn_revision() << ")"; … … 179 213 << "<head>\n" 180 214 << "<title> " << title << " - svndigest</title>\n" 215 << "<meta http-equiv=\"Content-type\" content=\"text/html; " 216 << "charset=UTF-8\" />\n" 181 217 << "<link rel=\"stylesheet\" " 182 218 << "href=\""; -
branches/src-highlight/lib/html_utility.h
r768 r1100 7 7 Copyright (C) 2006 Peter Johansson 8 8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 200 8Peter Johansson9 Copyright (C) 2009, 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 47 47 const std::string& title="", 48 48 const std::string& color=""); 49 50 /** 51 */ 52 std::string image(const std::string& name); 49 53 50 54 /// -
branches/src-highlight/lib/rmdirhier.cc
r823 r1100 3 3 /* 4 4 Copyright (C) 2006 Jari Häkkinen 5 Copyright (C) 2007, 2008 Peter Johansson 5 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 Copyright (C) 2010 Peter Johansson 6 7 7 8 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 78 79 return; 79 80 } 80 if ( chdir(dir.c_str()))81 if (::chdir(dir.c_str())) 81 82 throw BadDirectory(concatenate_path(pwd(),dir)); 82 83 -
branches/src-highlight/lib/rmdirhier.h
r768 r1100 6 6 /* 7 7 Copyright (C) 2006 Jari Häkkinen 8 Copyright (C) 2007, 2008 Peter Johansson8 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/subversion_info.cc.in
r726 r1100 2 2 3 3 /* 4 Copyright (C) 2008 Peter Johansson4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/subversion_info.h
r726 r1100 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Peter Johansson 7 Copyright (C) 2007 Peter Johansson 8 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/utility.cc
r797 r1100 2 2 3 3 /* 4 Copyright (C) 2006, 2007, 200 9 Jari Häkkinen, Peter Johansson5 Copyright (C) 20 08, 2009Peter Johansson4 Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 25 25 #include "subversion_info.h" 26 26 #include "config.h" 27 28 #include "yat/Exception.h" 27 29 28 30 #include <cassert> … … 31 33 #include <cstdlib> 32 34 #include <cstring> 35 #include <fnmatch.h> 33 36 #include <fstream> 34 37 #include <sstream> … … 67 70 68 71 72 void chdir(const std::string& dir) 73 { 74 if (::chdir(dir.c_str()) ) 75 throw yat::utility::errno_error("chdir: " + dir + ":"); 76 } 77 78 69 79 std::string concatenate_path(std::string dir, std::string base) 70 80 { … … 107 117 108 118 109 bool equal(std::string::const_iterator first1,110 std::string::const_iterator end1,111 std::string::const_iterator first2,112 std::string::const_iterator end2)113 {114 if (first1==end1 && first2==end2)115 return true;116 if (first1!=end1 && first2!=end2 &&117 (*first1==*first2 || *first1=='*' || *first2=='*' ||118 *first1=='?' || *first2=='?') &&119 equal(first1+1, end1, first2+1, end2) )120 return true;121 if ( (first1!=end1 && first2!=end2 && (*first1=='*'|| *first2=='*') ) &&122 (equal(first1+1, end1, first2, end2) ||123 equal(first1, end1, first2+1, end2))124 )125 return true;126 return false;127 }128 129 130 119 std::string file_name(const std::string& full_path) 131 120 { … … 167 156 168 157 158 bool fnmatch(const std::string& pattern, const std::string& str) 159 { 160 int res = ::fnmatch(pattern.c_str(), str.c_str(), 0); 161 if (res==0) 162 return true; 163 if (res!=FNM_NOMATCH) { 164 std::stringstream ss; 165 ss << "fnmatch with args: " << pattern << ", " << str; 166 throw std::runtime_error(ss.str()); 167 } 168 return false; 169 } 170 171 169 172 std::string ltrim(std::string str) 170 173 { … … 220 223 221 224 222 bool regexp(std::string::const_iterator first1, 223 std::string::const_iterator last1, 224 std::string::const_iterator first2, 225 std::string::const_iterator last2, 225 bool regexp(const std::string& pattern, const std::string& str, 226 226 std::vector<std::string>& vec) 227 227 { 228 if (vec.empty()) 229 vec.push_back(""); 230 231 // first two cases when ranges are empty 232 if (first1==last1 && first2==last2){ 233 vec.pop_back(); 234 return true; 235 } 228 bool regexp__(std::string::const_iterator first1, 229 std::string::const_iterator last1, 230 std::string::const_iterator first2, 231 std::string::const_iterator last2, 232 std::vector<std::string>::iterator item); 233 234 // find number of special chars 235 size_t count=0; 236 for (std::string::const_iterator i=pattern.begin(); i!=pattern.end(); ++i) 237 if (*i=='*' || *i=='?' || *i=='[') 238 ++count; 239 vec.resize(count); 240 return regexp__(pattern.begin(), pattern.end(), str.begin(), str.end(), 241 vec.begin()); 242 } 243 244 bool regexp__(std::string::const_iterator first1, 245 std::string::const_iterator last1, 246 std::string::const_iterator first2, 247 std::string::const_iterator last2, 248 std::vector<std::string>::iterator item) 249 { 250 if (first1==last1) { 251 return first2==last2; 252 } 253 if (*first1 == '*') { 254 if (first2<last2) { 255 item->push_back(*first2); 256 if (regexp__(first1, last1, first2+1, last2, item)) 257 return true; 258 item->resize(item->size()-1); 259 } 260 return regexp__(first1+1, last1, first2, last2, item+1); 261 } 262 if (*first1 == '?') { 263 if (first2==last2) 264 return false; 265 *item = *first2; 266 return regexp__(first1+1, last1, first2+1, last2, item+1); 267 } 268 if (*first1 == '[') { 269 if (first2==last2) 270 return false; 271 bool found = false; 272 while (*first1 != ']') { 273 if (*first1 == *first2) { 274 found = true; 275 *item = *first2; 276 } 277 ++first1; 278 assert(first1!=last1); 279 } 280 return regexp__(first1+1, last1, first2+1, last2, item+1); 281 /* 282 while (*first2 != ']') { 283 if (*first2==*first1) { 284 found = true; 285 vec.back() = *first1; 286 vec.push_back(""); 287 } 288 ++first2; 289 assert(first2!=last2); 290 } 291 if (!found) 292 return false; 293 return regexp(first1+1, last1, first2+1, last2, vec); 294 */ 295 } 296 297 if (first2==last2) 298 return false; 299 if (*first1 != *first2) 300 return false; 301 return regexp__(first1+1, last1, first2+1, last2, item); 302 303 /* 304 305 306 307 if (first1==last1) 308 return false; 309 if (*first1 != *first2) 310 return false; 311 return regexp(first1+1, last1, first2+1, last2, vec); 312 313 /// hm 236 314 if (first1==last1 || first2==last2) 237 315 return false; … … 271 349 return false; 272 350 return regexp(++first1, last1, ++first2, last2, vec); 351 */ 273 352 } 274 353 -
branches/src-highlight/lib/utility.h
r796 r1100 7 7 Copyright (C) 2005 Peter Johansson 8 8 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 9 Copyright (C) 2009 Peter Johansson9 Copyright (C) 2009, 2010 Peter Johansson 10 10 11 11 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 57 57 58 58 /** 59 wrapper around GNU C Library function chdir 60 61 \throw if underlying chdir call does not return 0 62 */ 63 void chdir(const std::string& dir); 64 65 /** 59 66 \return dir+base if dir ends with '/', else dir+'/'+base 60 67 */ … … 78 85 std::string directory_name(std::string path); 79 86 80 /**81 Function to compare strings. Strings may contain '*'.82 83 \return true if \a a and \a b are identical.84 */85 bool equal(std::string::const_iterator first1,86 std::string::const_iterator end1,87 std::string::const_iterator first2,88 std::string::const_iterator end2);89 90 87 /// 91 88 /// @return everything after last '/' 92 89 /// 93 90 std::string file_name(const std::string&); 91 92 /** 93 \return true if \a str matches \a pattern 94 95 \see fnmatch(3) 96 */ 97 bool fnmatch(const std::string& pattern, const std::string& str); 94 98 95 99 /// … … 161 165 162 166 /** 163 \return true if first range match second range164 165 Second range may contain wildcards (such as '*' and '?'),in166 which case vector \a vec is filled with the corresponding strings167 in first range. The algorithm is greedy, i.e., wildcard * iswill167 \return true if \a str matches \a pattern 168 169 \a pattern may contain wildcards '*', '?' and \a vec will contain 170 the matching string in \a str. If it's not a match, \a vec is 171 undefined. The algorithm is greedy, i.e., wildcards '*' will 168 172 consume as many charcters as possible. 169 173 170 174 \note \a vec is supposed to be empty 171 175 */ 172 bool regexp(std::string::const_iterator first1, 173 std::string::const_iterator end1, 174 std::string::const_iterator first2, 175 std::string::const_iterator end2, 176 bool regexp(const std::string& pattern, const std::string& str, 176 177 std::vector<std::string>& vec); 177 178 -
branches/src-highlight/lib/yat/ColumnStream.cc
r795 r1100 1 // $Id: ColumnStream.cc 1797 2009-02-12 18:07:10Z peter $1 // $Id: ColumnStream.cc 2119 2009-12-12 23:11:43Z peter $ 2 2 3 3 /* -
branches/src-highlight/lib/yat/ColumnStream.h
r795 r1100 2 2 #define _theplu_yat__utility_column_stream_ 3 3 4 // $Id: ColumnStream.h 1887 2009-03-31 17:38:16Z peter $4 // $Id: ColumnStream.h 2119 2009-12-12 23:11:43Z peter $ 5 5 6 6 /* … … 24 24 */ 25 25 #include <fstream> 26 #include <ios tream>26 #include <iosfwd> 27 27 #include <sstream> 28 28 #include <vector> -
branches/src-highlight/lib/yat/CommandLine.cc
r824 r1100 1 // $Id: CommandLine.cc 2 046 2009-09-02 21:42:32Z peter $1 // $Id: CommandLine.cc 2265 2010-06-05 23:12:10Z peter $ 2 2 3 3 /* … … 5 5 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 6 6 Copyright (C) 2009 Peter Johansson 7 Copyright (C) 2010 Jari Häkkinen, Peter Johansson 7 8 8 9 This file is part of the yat library, http://dev.thep.lu.se/yat … … 31 32 32 33 #include <algorithm> 34 #include <cassert> 33 35 #include <functional> 34 36 #include <fstream> … … 60 62 ss << "yat::utility::Commandline: two options with long_name: " 61 63 << option.long_name(); 62 throw std::runtime_error(ss.str());64 throw runtime_error(ss.str()); 63 65 } 64 66 long_options_[option.long_name()] = &option; … … 69 71 ss << "yat::utility::Commandline: two options with short_name: " 70 72 << option.short_name(); 71 throw std::runtime_error(ss.str());73 throw runtime_error(ss.str()); 72 74 } 73 75 short_options_[option.short_name()] = &option; … … 196 198 197 199 200 void CommandLine::sort(void) 201 { 202 sort(OptionCompare()); 203 } 204 205 198 206 std::vector<std::string> CommandLine::split(std::string str, char del) const 199 207 { … … 236 244 237 245 246 bool CommandLine::OptionCompare::operator()(const Option* lhs, 247 const Option* rhs) const 248 { 249 assert(lhs); 250 assert(rhs); 251 std::string lhs_str = lhs->long_name(); 252 if (lhs_str.empty()) 253 lhs_str = lhs->short_name(); 254 std::string rhs_str = rhs->long_name(); 255 if (rhs_str.empty()) 256 rhs_str = rhs->short_name(); 257 return lhs_str < rhs_str; 258 } 259 260 238 261 }}} // of namespace utility, yat, and theplu -
branches/src-highlight/lib/yat/CommandLine.h
r824 r1100 2 2 #define _theplu_yat_utility_commandline_ 3 3 4 //$Id: CommandLine.h 2 054 2009-09-06 18:25:06Z peter $4 //$Id: CommandLine.h 2265 2010-06-05 23:12:10Z peter $ 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 7 Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson 9 8 10 9 This file is part of the yat library, http://dev.thep.lu.se/yat … … 24 23 */ 25 24 25 #include <algorithm> 26 26 #include <cctype> 27 27 #include <map> … … 158 158 159 159 /** 160 \brief Sort Options how they will appear in (help) output. 161 162 This function will sort the Options in alphabetical order. If 163 the Option has a long_name, it is used for the sorting; 164 otherwise, the short_name is used. 165 166 \since New in yat 0.7 167 */ 168 void sort(void); 169 170 /** 171 Like sort(void) but using \a compare to sort Options. 172 173 The functor Compare must be a <a 174 href="http://www.sgi.com/tech/stl/BinaryFunction.html">Binary 175 Function</a> with both argument types \c const \c Option* and 176 return type \c bool. 177 178 \since New in yat 0.7 179 */ 180 template<class Compare> 181 void sort(Compare compare); 182 183 /** 160 184 \return something like "Try `<program_name()> --help` for 161 185 more information." … … 165 189 private: 166 190 friend std::ostream& operator<<(std::ostream& os, const CommandLine& cl); 167 void add_private(std::string, Option&);168 191 bool is_long_option(std::string str) const; 169 192 bool is_short_option(std::string str) const; … … 178 201 bool parsed_; 179 202 std::string program_name_; 203 204 struct OptionCompare 205 { 206 bool operator()(const Option*, const Option*) const; 207 }; 208 180 209 }; 181 210 … … 200 229 std::ostream& operator<<(std::ostream&, const CommandLine&); 201 230 231 template<class Compare> 232 void CommandLine::sort(Compare compare) 233 { 234 std::sort(options_.begin(), options_.end(), compare); 235 } 236 202 237 }}} // end of namespace utility, yat, and theplu 203 238 -
branches/src-highlight/lib/yat/Exception.h
r795 r1100 2 2 #define _theplu_yat_utility_exception_ 3 3 4 // $Id: Exception.h 1797 2009-02-12 18:07:10Z peter $4 // $Id: Exception.h 2210 2010-03-05 22:59:01Z peter $ 5 5 6 6 /* 7 7 Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2010 Peter Johansson 8 9 9 10 This file is part of the yat library, http://dev.thep.lu.se/yat … … 30 31 namespace utility { 31 32 33 34 35 /** 36 \brief Class used for all runtime error detected within yat library. 37 */ 38 class runtime_error : public std::runtime_error 39 { 40 public: 41 /** 42 \brief Constructor 43 44 \param message message to be displayed using function what(). 45 */ 46 runtime_error(std::string message); 47 }; 48 49 32 50 /** 33 51 \brief Class used for error reported from Commandline or Option. … … 41 59 \param message message to be displayed using function what(). 42 60 */ 43 inline cmd_error(std::string message) 44 : std::runtime_error(message) {} 61 cmd_error(std::string message); 62 }; 63 64 65 /** 66 \brief Class that contains information reported bia global 67 variable errno. 68 */ 69 class errno_error : public std::runtime_error 70 { 71 public: 72 /** 73 The error message, return from what(), is set to 74 \a message + strerror(errno) 75 */ 76 errno_error(std::string message); 77 }; 78 79 /** 80 \brief Class for errors reported from underlying GSL calls. 81 82 GSL_error is used in the same way as C++ standard library 83 exceptions. 84 */ 85 class GSL_error : public std::runtime_error 86 { 87 public: 88 /** 89 \brief Constructor to create an exception with a message. 90 */ 91 GSL_error(std::string message); 92 93 /** 94 \brief Constructor to create an exception with a message 95 containg the GSL error description. 96 */ 97 GSL_error(std::string message, int gsl_status); 45 98 }; 46 99 … … 58 111 \brief Constructor to create an exception with a message. 59 112 */ 60 inline IO_error(std::string message) throw() 61 : std::runtime_error("IO_error: " + message) {} 113 IO_error(std::string message); 62 114 }; 63 115 -
branches/src-highlight/lib/yat/Makefile.am
r795 r1100 3 3 ## $Id$ 4 4 5 # Copyright (C) 2009 Peter Johansson5 # Copyright (C) 2009, 2010 Peter Johansson 6 6 # 7 7 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 22 22 MOVE_IF_CHANGE = $(SHELL) $(abs_top_srcdir)/build_support/move-if-change 23 23 24 AM_CPPFLAGS = $( SVNDIGEST_CPPFLAGS)25 AM_CXXFLAGS = $( SVNDIGEST_CXXFLAGS)24 AM_CPPFLAGS = $(DEFAULT_CPPFLAGS) 25 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS) 26 26 27 27 noinst_LIBRARIES = libyat.a … … 42 42 libyat_a_SOURCES += ColumnStream.cc 43 43 libyat_a_SOURCES += CommandLine.cc 44 libyat_a_SOURCES += Exception.cc 44 45 libyat_a_SOURCES += Option.cc 45 46 libyat_a_SOURCES += OptionHelp.cc … … 57 58 test -d Fetchdir || $(SVN) co $(yat_url) Fetchdir 58 59 (cd Fetchdir && $(SVN) revert -Rq . && $(SVN) update) 59 cp $(srcdir)/Exception. h.diffFetchdir60 (cd Fetchdir && patch -i Exception. h.diff|| exit 1)60 cp $(srcdir)/Exception.cc.patch Fetchdir 61 (cd Fetchdir && patch -i Exception.cc.patch || exit 1) 61 62 @for f in $(FETCH_FILES); do \ 62 63 $(MOVE_IF_CHANGE) -v Fetchdir/$$f $(srcdir)/$$f; \ -
branches/src-highlight/lib/yat/Option.cc
r795 r1100 1 // $Id: Option.cc 1797 2009-02-12 18:07:10Z peter $1 // $Id: Option.cc 2210 2010-03-05 22:59:01Z peter $ 2 2 3 3 /* … … 23 23 #include "Option.h" 24 24 #include "CommandLine.h" 25 #include "Exception.h" 25 26 26 27 #include <iostream> 27 28 #include <sstream> 28 #include <stdexcept>29 29 #include <string> 30 30 … … 38 38 { 39 39 if (flag.empty()) 40 throw std::runtime_error("yat: Option: given flag is empty");40 throw runtime_error("yat: Option: given flag is empty"); 41 41 if (flag.size()==1 || (flag.size()==2 && flag[1]==',')) 42 42 short_name_ = flag[0]; … … 89 89 { 90 90 if (!cmd().parsed()) { 91 std::string s("Option::present called before Commandline was parsed"); 91 std::string s("theplu::yat::utility::Option::present"); 92 s += " called before Commandline was parsed"; 92 93 throw std::logic_error(s); 93 94 } -
branches/src-highlight/lib/yat/Option.h
r824 r1100 2 2 #define _theplu_yat_utility_option_ 3 3 4 // $Id: Option.h 2 046 2009-09-02 21:42:32Z peter $4 // $Id: Option.h 2119 2009-12-12 23:11:43Z peter $ 5 5 6 6 /* -
branches/src-highlight/lib/yat/OptionArg.h
r824 r1100 2 2 #define _theplu_yat_utility_option_arg_ 3 3 4 // $Id: OptionArg.h 2 046 2009-09-02 21:42:32Z peter $4 // $Id: OptionArg.h 2210 2010-03-05 22:59:01Z peter $ 5 5 6 6 /* … … 134 134 } 135 135 136 void assign(std::string& lhs, std::stringrhs )136 void assign(std::string& lhs, const std::string& rhs ) 137 137 { 138 138 lhs = rhs; … … 140 140 141 141 template<class T1> 142 void assign(T1& lhs, std::stringrhs )142 void assign(T1& lhs, const std::string& rhs ) 143 143 { 144 144 try { 145 145 lhs = convert<T1>(rhs); 146 146 } 147 catch ( std::runtime_error& e) {147 catch (runtime_error& e) { 148 148 std::stringstream sstr(rhs); 149 149 sstr << ": invalid argument"; -
branches/src-highlight/lib/yat/OptionHelp.cc
r824 r1100 1 // $Id: OptionHelp.cc 2 055 2009-09-08 18:23:43Z peter $1 // $Id: OptionHelp.cc 2246 2010-04-22 00:53:23Z peter $ 2 2 3 3 /* 4 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 This file is part of the yat library, http://dev.thep.lu.se/yat … … 49 50 std::cout << cmd() << "\n"; 50 51 std::cout << post_cmd_; 51 exit( 0);52 exit(EXIT_SUCCESS); 52 53 } 53 54 -
branches/src-highlight/lib/yat/OptionHelp.h
r795 r1100 2 2 #define _theplu_yat_utility_option_help_ 3 3 4 // $Id: OptionHelp.h 1797 2009-02-12 18:07:10Z peter $4 // $Id: OptionHelp.h 2119 2009-12-12 23:11:43Z peter $ 5 5 6 6 /* -
branches/src-highlight/lib/yat/OptionSwitch.cc
r795 r1100 1 // $Id: OptionSwitch.cc 1797 2009-02-12 18:07:10Z peter $1 // $Id: OptionSwitch.cc 2119 2009-12-12 23:11:43Z peter $ 2 2 3 3 /* -
branches/src-highlight/lib/yat/OptionSwitch.h
r795 r1100 2 2 #define _theplu_yat_utility_option_switch_ 3 3 4 // $Id: OptionSwitch.h 1797 2009-02-12 18:07:10Z peter $4 // $Id: OptionSwitch.h 2119 2009-12-12 23:11:43Z peter $ 5 5 6 6 /* -
branches/src-highlight/lib/yat/README
r826 r1100 8 8 fetch'. Be careful doing this and particularly in sensitive branches 9 9 such as a stable-branch. All files are left pristine except 10 `Exception. h' that is modified to avoid a dependency to GSL.10 `Exception.cc' that is modified to avoid a dependency to GSL. 11 11 12 12 How to add a new file from yat? Add the file to 'noinst_HEADERS' or … … 19 19 20 20 21 Copyright (C) 2009 Peter Johansson21 Copyright (C) 2009, 2010 Peter Johansson 22 22 23 23 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/lib/yat/config_public.h.in
r798 r1100 2 2 #define _theplu_yat_utility_config_public_ 3 3 4 // $Id: config_public.h.in 1797 2009-02-12 18:07:10Z peter $4 // $Id: config_public.h.in 2140 2009-12-31 22:43:29Z peter $ 5 5 6 6 /* 7 7 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 8 9 9 This file is part of the yat library, http:// trac.thep.lu.se/yat10 This file is part of the yat library, http://dev.thep.lu.se/yat 10 11 11 12 The yat library is free software; you can redistribute it and/or -
branches/src-highlight/lib/yat/deprecate.h
r824 r1100 2 2 #define _theplu_yat_utility_deprecate_ 3 3 4 // $Id: deprecate.h 2 062 2009-09-14 20:19:17Z peter $4 // $Id: deprecate.h 2124 2009-12-19 22:43:03Z peter $ 5 5 6 6 /* 7 7 Copyright (C) 2008, 2009 Peter Johansson 8 8 9 This file is part of the yat library, http:// trac.thep.lu.se/yat9 This file is part of the yat library, http://dev.thep.lu.se/yat 10 10 11 11 The yat library is free software; you can redistribute it and/or -
branches/src-highlight/lib/yat/utility.h
r824 r1100 2 2 #define _theplu_yat_utility_utility_ 3 3 4 // $Id: utility.h 2 055 2009-09-08 18:23:43Z peter $4 // $Id: utility.h 2248 2010-04-22 00:57:13Z peter $ 5 5 6 6 /* … … 88 88 89 89 /** 90 @return true if string \a s fulfills regular expression \verbatim 91 ^\w* \endverbatim \a other \verbatim \w*$ \endverbatim (case 92 insensitive) 90 This function takes the first word (separated by whitespace) in 91 \a s, replaces all upper case with lower case, and compares it 92 with \a other. 93 94 \return true if processed \a s is equal to \a other. It returns 95 false otherwise or if \a s contains more than one word. 93 96 */ 94 97 bool is_equal(std::string s, std::string other); … … 146 149 147 150 \note Requirement on T: utility::convert<T> must be supported 151 (from yat 0.7 T=string is also supported) 148 152 149 153 \since New in yat 0.6 … … 170 174 171 175 \note Requirement on T: utility::convert<T> must be supported 176 (from yat 0.7 T=string is also supported) 172 177 173 178 \since New in yat 0.6 … … 176 181 void load(std::istream& is, std::vector<T>& vec, char sep='\0'); 177 182 183 // private namespace 184 namespace detail { 185 /** 186 Functor used in load function 187 */ 188 template<typename T> 189 struct VectorPusher 190 { 191 /** 192 convert element to T and push on vec's back 193 194 \internal 195 */ 196 void operator()(const std::string& element, std::vector<T>& vec) 197 { 198 if (!element.size()) 199 vec.push_back(std::numeric_limits<T>::quiet_NaN()); 200 else { 201 vec.push_back(theplu::yat::utility::convert<T>(element)); 202 } 203 } 204 }; 205 206 /** 207 specialization for string 208 209 \internal 210 */ 211 template<> 212 struct VectorPusher<std::string> 213 { 214 /** 215 push element on vec's back 216 */ 217 void operator()(const std::string& element, std::vector<std::string>& vec) 218 { 219 vec.push_back(element); 220 } 221 }; 222 223 } // end of namespace detail 224 225 178 226 // template implementations 179 227 … … 209 257 return -std::numeric_limits<T>::infinity(); 210 258 else 211 throw std::runtime_error(std::string("yat::utility::convert(\"")+s+212 259 throw runtime_error(std::string("yat::utility::convert(\"")+s+ 260 std::string("\"): type is unsigned") ); 213 261 } 214 262 std::stringstream ss(s); … … 222 270 ss >> b; 223 271 if (!b.empty() || !ok) 224 throw std::runtime_error(std::string("yat::utility::convert(\"")+s+225 272 throw runtime_error(std::string("yat::utility::convert(\"")+s+ 273 std::string("\")")); 226 274 return a; 227 275 } … … 284 332 void load(std::istream& is, std::vector<T>& vec, char sep='\0') 285 333 { 334 detail::VectorPusher<T> pusher; 286 335 std::string element; 287 336 bool ok=true; 288 while( ok) {337 while(true) { 289 338 if(sep=='\0') 290 339 ok=(is>>element); … … 294 343 break; 295 344 296 if (!element.size()) 297 vec.push_back(std::numeric_limits<T>::quiet_NaN()); 298 else { 299 vec.push_back(convert<T>(element)); 300 } 345 pusher(element, vec); 301 346 } 302 347 } -
branches/src-highlight/m4/apache_LICENSE-2.0.txt
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/src-highlight/m4/ax_cxx_check_flag.m4
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/src-highlight/m4/ax_cxxcpp_check_flag.m4
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/src-highlight/m4/ax_ld_check_flag.m4
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/src-highlight/m4/find_apr.m4
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/src-highlight/m4/version.m4
- Property svn:mergeinfo changed
/trunk/m4/version.m4 (added) merged: 847,849,978,1003,1059
r775 r1100 2 2 # 3 3 # Copyright (C) 2008 Jari Häkkinen, Peter Johansson 4 # Copyright (C) 2009, 2010 Peter Johansson 4 5 # 5 # This file is part of svndigest, http:// trac.thep.lu.se/svndigest6 # This file is part of svndigest, http://dev.thep.lu.se/svndigest 6 7 # 7 8 # svndigest is free software; you can redistribute it and/or modify it … … 25 26 m4_define([MAJOR_VERSION], [0]) 26 27 # MINOR - Modify when new functionality is added 27 m4_define([MINOR_VERSION], [ 7])28 m4_define([MINOR_VERSION], [8]) 28 29 # PATCH - Modify for every released patch 29 30 m4_define([PATCH_VERSION], [0]) - Property svn:mergeinfo changed
-
branches/src-highlight/m4/yat_add_flag.m4
- Property svn:mergeinfo changed
/trunk/m4/yat_add_flag.m4 (added) merged: 1042
r777 r1100 1 ## $Id: yat_add_flag.m4 1780 2009-02-06 18:13:22Z peter $1 ## $Id: yat_add_flag.m4 2107 2009-11-07 15:53:27Z peter $ 2 2 3 3 # SYNOPSIS … … 17 17 # LAST MODIFICATION 18 18 # 19 # $Date: 2009- 02-06 13:13:22 -0500 (Fri, 06 Feb2009) $19 # $Date: 2009-11-07 10:53:27 -0500 (Sat, 07 Nov 2009) $ 20 20 # 21 21 # COPYLEFT … … 40 40 41 41 # 42 # serial 242 # serial 5 43 43 # 44 44 # see http://www.gnu.org/software/automake/manual/automake.html#Serials … … 46 46 AC_DEFUN([YAT_CPP_ADD_FLAG], 47 47 [ 48 for i in $2; do 49 YAT_FIND_STR([$1], [$i], , [AX_CXXCPP_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) 48 AC_PREREQ([2.63]) dnl we use AS_VAR_IF 49 AC_REQUIRE([AC_PROG_SED]) 50 for yat_flag in $2; do 51 # ignore flag if 52 # 1) it is -I/usr/include 53 # 2) it is -I/usr/local/include and CXX is g++ 54 # 3) it is -D* and * is already defined in $1, $CPPFLAGS, or AC_DEFINE 55 ignore=no 56 AS_CASE([$yat_flag], 57 [-I/usr/include], [ignore=yes], 58 [-I/usr/local/include],[AS_IF([test "x$CXX" = "xg++"],[ignore=yes])], 59 [-D*], [yat_def=`AS_ECHO([$yat_flag]) | $SED 's,^-D,,;s,=.*,,'`; 60 yat_save_CPPFLAGS="$CPPFLAGS" 61 m4_if([$1], [CPPFLAGS], [], [CPPFLAGS="$$1 $CPPFLAGS"]) 62 AC_CHECK_DECL([$yat_def],[ignore=yes]) 63 CPPFLAGS="$yat_save_CPPFLAGS"]) 64 65 AS_VAR_IF([ignore], [no], 66 [YAT_FIND_STR([$1], [$yat_flag], , 67 [AX_CXXCPP_CHECK_FLAG([$yat_flag], ,, 68 [$1="$$1 $yat_flag"])])]) 50 69 done 51 70 ]) # YAT_CPP_ADD_FLAG … … 54 73 AC_DEFUN([YAT_CXX_ADD_FLAG], 55 74 [ 56 for i in $2; do 57 YAT_FIND_STR([$1], [$i], , [AX_CXX_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) 75 AC_PREREQ([2.61]) dnl we use AX_CXX_CHECK_FLAG 76 for yat_flag in $2; do 77 YAT_FIND_STR([$1], [$yat_flag], , 78 [AX_CXX_CHECK_FLAG([$yat_flag], ,, [$1="$$1 $yat_flag"])]) 58 79 done 59 80 ]) # YAT_CXX_ADD_FLAG … … 61 82 AC_DEFUN([YAT_LD_ADD_FLAG], 62 83 [ 63 for i in $2; do 64 YAT_FIND_STR([$1], [$i], , [AX_LD_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) 84 AC_PREREQ([2.61]) dnl we use AX_LD_CHECK_FLAG 85 for yat_flag in $2; do 86 # ignore flag if 87 # 1) it is -L/usr/lib 88 # 2) it is -L/usr/local/lib and CXX is g++ 89 AS_IF([test "x$yat_flag" = "x-L/usr/lib"],, 90 [test "x$CXX" = "xg++" && test "x$yat_flag" = "x-L/usr/local/lib"],, 91 [YAT_FIND_STR([$1], [$yat_flag], , 92 [AX_LD_CHECK_FLAG([$yat_flag], ,, 93 [$1="$$1 $yat_flag"])])]) 65 94 done 66 95 ]) # YAT_LD_ADD_FLAG - Property svn:mergeinfo changed
-
branches/src-highlight/man/Makefile.am
r805 r1100 3 3 ## $Id$ 4 4 5 # Copyright (C) 2008 Peter Johansson5 # Copyright (C) 2008, 2009, 2010 Peter Johansson 6 6 # 7 # This file is part of svndigest, http:// trac.thep.lu.se/trac/svndigest7 # This file is part of svndigest, http://dev.thep.lu.se/trac/svndigest 8 8 # 9 9 # svndigest is free software; you can redistribute it and/or modify it … … 20 20 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 21 21 22 dist_man1_MANS = $(srcdir)/svndigest.1 22 dist_man1_MANS = 23 dist_man1_MANS += $(srcdir)/svncopyright.1 24 dist_man1_MANS += $(srcdir)/svndigest.1 25 dist_man1_MANS += $(srcdir)/svndigest-copy-cache.1 23 26 24 27 EXTRA_DIST = svndigest.x … … 26 29 MAINTAINERCLEANFILES = $(dist_man1_MANS) 27 30 28 if HAVE_HELP2MAN29 31 # we would like to depend on svndigest binary, but since svndigest.1 30 32 # is distributed it is recommended to depend on only distributed files 31 33 # (see automake manual 27.5). 32 34 $(srcdir)/svndigest.1: $(top_srcdir)/configure $(srcdir)/Makefile.in \ 33 $(srcdir)/svndigest.x 35 $(srcdir)/svndigest.x $(top_srcdir)/bin/svndigestParameter.cc 34 36 @$(HELP2MAN) --no-info -o $@ \ 35 37 --include $(srcdir)/svndigest.x \ 36 38 --version-option="--no-verbose --version" \ 37 39 $(top_builddir)/bin/svndigest$(EXEEXT) 38 else39 $(srcdir)/svndigest.1:40 echo "WARNING: bogus svndigest.1 is created" >&2; \41 echo 'ab help2man is required to generate this page' > $@42 40 43 # Checking that we don't ship a bogus man page, which might be created 44 # if help2man is not available. (The check can be removed in a future 45 # where we require Automake 1.11) 46 dist-hook: 47 echo "ERROR: svndigest.1 is bogus" >&2; \ 48 echo " you need help2man to generate a valid man page" >&2;\ 49 echo " install help2man, re-run `configure'," >&2;\ 50 echo " remove svndigest.1 and run 'make'" >&2;\ 51 exit 1; 52 endif 41 $(srcdir)/svncopyright.1: $(top_srcdir)/configure $(srcdir)/Makefile.in \ 42 $(srcdir)/svndigest.x $(top_srcdir)/bin/svncopyrightParameter.cc 43 @$(HELP2MAN) --no-info -o $@ \ 44 --include $(srcdir)/svndigest.x \ 45 --version-option="--no-verbose --version" \ 46 $(top_builddir)/bin/svncopyright$(EXEEXT) 47 48 $(srcdir)/svndigest-copy-cache.1: $(top_srcdir)/configure $(srcdir)/Makefile.in \ 49 $(srcdir)/svndigest.x $(top_srcdir)/bin/svndigest-copy-cache.in 50 @$(HELP2MAN) --no-info -o $@ \ 51 --include $(srcdir)/svndigest.x \ 52 $(top_builddir)/bin/svndigest-copy-cache 53 -
branches/src-highlight/test/Makefile.am
r801 r1100 3 3 ## $Id$ 4 4 5 # Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson6 # Copyright (C) 20 08, 2009Peter Johansson5 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 # Copyright (C) 2010 Peter Johansson 7 7 # 8 8 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 21 21 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 22 22 23 check_SCRIPTS = svn_update.sh 23 check_SCRIPTS = svn_update.sh init.sh 24 24 25 check_PROGRAMS = cache_partial_test \ 26 config_test copyright_test date_test gnuplot_pipe_test \ 25 ## we use suffix .cc for all source 26 AM_DEFAULT_SOURCE_EXT = .cc 27 28 EXTRA_PROGRAMS = cache_partial_test color_test \ 29 config_test copyright_test date_test \ 30 htmlstream_test \ 27 31 parser_test stats_test trac_test utility_test 28 32 29 TESTS = $(check_PROGRAMS) test_repo.sh check_repo_status.sh 33 CLEANFILES = $(EXTRA_PROGRAMS) 34 35 distributed_TESTS = 36 distributed_TESTS += cmd_format_test.sh 37 distributed_TESTS += config2_test.sh 38 distributed_TESTS += config3_test.sh 39 distributed_TESTS += copyright2_test.sh 40 distributed_TESTS += repo_status_test.sh 41 distributed_TESTS += repo_test.sh 42 distributed_TESTS += svncopyright_test.sh 43 distributed_TESTS += svndigest_copy_cache_test.sh 44 45 TESTS = $(EXTRA_PROGRAMS) $(distributed_TESTS) 46 47 TEST_EXTENSIONS = .sh 48 49 EXTRA_DIST = $(distributed_TESTS) 30 50 31 51 # tests not yet passing are listed here … … 40 60 $(top_builddir)/lib/libsvndigest.a \ 41 61 $(top_builddir)/lib/yat/libyat.a \ 42 $(SVN DIGEST_LIBS)43 AM_LDFLAGS = $( SVNDIGEST_LDFLAGS)62 $(SVN_LIBS) $(APR_LIBS) $(PLPLOT_LIBS) 63 AM_LDFLAGS = $(APR_LDFLAGS) $(SVN_LDFLAGS) $(PLPLOT_LDFLAGS) 44 64 45 AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS) 46 AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS) 65 AM_CPPFLAGS = -I$(top_srcdir)/lib $(APR_CPPFLAGS) $(SVN_CPPFLAGS) \ 66 $(DEFAULT_CPPFLAGS) $(PLPLOT_CPPFLAGS) 67 AM_CXXFLAGS = $(DEFAULT_CXXFLAGS) 47 68 48 69 libsvndigesttest_a_SOURCES = Suite.cc 49 70 50 cache_partial_test_SOURCES = cache_partial_test.cc51 config_test_SOURCES = config_test.cc52 copyright_test_SOURCES = copyright_test.cc53 date_test_SOURCES = date_test.cc54 gnuplot_pipe_test_SOURCES = gnuplot_pipe_test.cc55 parser_test_SOURCES = parser_test.cc56 stats_test_SOURCES = stats_test.cc57 trac_test_SOURCES = trac_test.cc58 utility_test_SOURCES = utility_test.cc59 60 71 clean-local: 61 rm -rf generated_output toy_project 72 rm -rf generated_output toy_project testSubDir 62 73 63 74 mostlyclean-local: 64 rm -f *.png *.tmp *~ 75 rm -f *.png *.tmp *~ .toy_project2 76 77 .PHONY: lazycheck 78 79 lazycheck:; $(MAKE) $(AM_MAKEFLAGS) check RECHECK_LOGS= 80 81 # dependencies for lazycheck 82 cmd_format_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) 83 config2_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) 84 config3_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) 85 copyright2_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) 86 repo_status_test.log:init.sh 87 repo_test.log:init.sh $(top_builddir)/bin/svndigest$(EXEEXT) 88 svncopyright_test.log:init.sh $(top_builddir)/bin/svncopyright$(EXEEXT) 89 svndigest_copy_cache_test.log:init.sh $(top_builddir)/bin/svndigest-copy-cache 90 91 -
branches/src-highlight/test/Suite.cc
r803 r1100 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson 4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 5 6 6 7 This file is part of the yat library, http://dev.thep.lu.se/yat … … 41 42 42 43 Suite::Suite(int argc, char* argv[], bool need_test_repo) 43 : dev_null_(NULL), ok_(true), verbose_(false) 44 { 45 char* buffer=std::getenv("VERBOSE"); 46 if ( (argc>1 && (argv[1]==std::string("-v") 47 || argv[1]==std::string("--verbose")) 48 || (buffer && buffer == std::string("1"))) ) { 49 verbose_=true; 50 } 51 else 52 dev_null_ = new std::ofstream("/dev/null"); 53 44 : ok_(true) 45 { 46 chdir(abs_builddir()); 47 std::string test_dir = concatenate_path("testSubDir", file_name(argv[0])); 48 mkdir_p(test_dir); 49 chdir(test_dir); 54 50 if (need_test_repo) { 55 51 bool have_test_repo=false; … … 69 65 Suite::~Suite(void) 70 66 { 71 delete dev_null_;72 67 } 73 68 … … 88 83 std::ostream& Suite::out(void) const 89 84 { 90 if (verbose()) 91 return std::cout; 92 return *dev_null_; 85 return std::cout; 93 86 } 94 87 … … 274 267 bool Suite::verbose(void) const 275 268 { 276 return verbose_; 269 // we are always verbose nowadays 270 return true; 277 271 } 278 272 -
branches/src-highlight/test/Suite.h
r803 r1100 5 5 6 6 /* 7 Copyright (C) 2008, 2009 Peter Johansson 7 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 8 9 9 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 60 61 61 62 private: 62 std::ofstream* dev_null_;63 63 bool ok_; 64 bool verbose_;65 64 66 65 void checkout_test_wc(void) const; -
branches/src-highlight/test/cache_partial_test.cc
r803 r1100 2 2 3 3 /* 4 Copyright (C) 2009 Peter Johansson4 Copyright (C) 2009, 2010 Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 38 38 test::Suite suite(argc, argv, true); 39 39 40 mkdir_p( test::filename("toy_project/.svndigest"));41 std::string root= test::filename("toy_project");40 mkdir_p("toy_project/.svndigest"); 41 std::string root="toy_project"; 42 42 std::string filename = root + "/AUTHORS"; 43 43 suite.out() << "Create SVN instance" << std::endl; -
branches/src-highlight/test/config_test.cc
r817 r1100 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson 4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 20 21 */ 21 22 23 #include "Suite.h" 24 22 25 #include "Configuration.h" 23 26 24 27 namespace theplu{ 25 28 namespace svndigest{ 26 bool test_codon(void); 29 void test_codon(test::Suite&); 30 void test_read_write(test::Suite&); 27 31 }} // end of namespace svndigest and theplu 28 32 … … 31 35 { 32 36 using namespace theplu::svndigest; 33 bool ok=true;37 test::Suite suite(argc, argv, false); 34 38 35 ok &= test_codon(); 39 test_codon(suite); 40 test_read_write(suite); 36 41 37 if (ok) 42 if (suite.ok()) { 43 suite.out() << "Test is Ok!" << std::endl; 38 44 return 0; 39 return 1; 45 } 46 suite.out() << "Test failed." << std::endl; 47 return 1; 40 48 } 41 49 … … 44 52 namespace svndigest{ 45 53 46 bool test_codon(void)54 void test_codon(test::Suite& suite) 47 55 { 48 56 const Configuration& c(Configuration::instance()); 49 bool ok =true;50 57 if (!c.codon("foo.h")){ 51 s td::cerr<< "No codon for foo.h\n";52 ok = false;58 suite.out() << "No codon for foo.h\n"; 59 suite.add(false); 53 60 } 54 if (!c.codon(" ../dir/test.cc")){55 s td::cerr<< "No codon for test.cc\n";56 ok = false;61 if (!c.codon("/dir/test.cc")){ 62 suite.out() << "No codon for test.cc\n"; 63 suite.add(false); 57 64 } 58 59 return ok; 65 if (!c.codon("bootstrap")){ 66 suite.out() << "No codon for bootstrap\n"; 67 suite.add(false); 68 } 60 69 } 61 70 71 void test_read_write(test::Suite& suite) 72 { 73 Configuration& config = Configuration::instance(); 74 std::stringstream ss; 75 ss << config; 76 config.load(ss); 77 std::stringstream ss2; 78 ss2 << config; 79 if (ss2.str() != ss.str()) { 80 suite.out() << "error: configuration output not equal\n"; 81 suite.out() << "defalt output:\n" << ss.str() << "\n"; 82 suite.out() << "second output:\n" << ss2.str() << "\n"; 83 suite.add(false); 84 } 85 } 86 62 87 }} // end of namespace svndigest and theplu -
branches/src-highlight/test/copyright_test.cc
r744 r1100 2 2 3 3 /* 4 Copyright (C) 2008, 2009 Peter Johansson 4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 41 42 test::Suite suite(argc, argv, true); 42 43 43 std::string root= test::filename("toy_project");44 std::string root="toy_project"; 44 45 std::string filename = root + "/README"; 45 46 -
branches/src-highlight/test/data/AUTHORS.svndigest-cache-r61
r792 r1100 1 CACHE FILE VERSION 61 CACHE FILE VERSION 7 2 2 48 1 3 3 jari 4 CACHE FILE VERSION 64 CACHE FILE VERSION 7 5 5 all 6 6 7 7 jari 8 8 9 CACHE FILE VERSION 69 CACHE FILE VERSION 7 10 10 all 11 11 2 6 12 12 jari 13 13 2 6 14 CACHE FILE VERSION 614 CACHE FILE VERSION 7 15 15 all 16 16 2 8 17 17 jari 18 18 2 8 19 CACHE FILE VERSION 619 CACHE FILE VERSION 7 20 20 all 21 21 22 22 jari 23 23 24 CACHE FILE VERSION 624 CACHE FILE VERSION 7 25 25 all 26 26 2 8 27 27 jari 28 28 2 8 29 CACHE FILE VERSION 629 CACHE FILE VERSION 7 30 30 all 31 31 2 14 32 32 jari 33 33 2 14 34 CACHE FILE VERSION 635 CACHE FILE VERSION 634 CACHE FILE VERSION 7 35 CACHE FILE VERSION 7 36 36 48 1 37 37 jari 38 CACHE FILE VERSION 638 CACHE FILE VERSION 7 39 39 all 40 40 41 41 jari 42 42 43 CACHE FILE VERSION 643 CACHE FILE VERSION 7 44 44 all 45 45 2 6 48 4294967292 46 46 jari 47 47 2 6 48 4294967292 48 CACHE FILE VERSION 648 CACHE FILE VERSION 7 49 49 all 50 50 2 8 48 4294967293 51 51 jari 52 52 2 8 48 4294967293 53 CACHE FILE VERSION 653 CACHE FILE VERSION 7 54 54 all 55 55 56 56 jari 57 57 58 CACHE FILE VERSION 658 CACHE FILE VERSION 7 59 59 all 60 60 2 8 48 4294967293 61 61 jari 62 62 2 8 48 4294967293 63 CACHE FILE VERSION 663 CACHE FILE VERSION 7 64 64 all 65 65 2 14 48 4294967289 66 66 jari 67 67 2 14 48 4294967289 68 CACHE FILE VERSION 669 CACHE FILE VERSION 668 CACHE FILE VERSION 7 69 CACHE FILE VERSION 7 70 70 48 1 71 71 jari 72 CACHE FILE VERSION 672 CACHE FILE VERSION 7 73 73 all 74 74 75 75 jari 76 76 77 CACHE FILE VERSION 677 CACHE FILE VERSION 7 78 78 all 79 79 2 2 80 80 jari 81 81 2 2 82 CACHE FILE VERSION 682 CACHE FILE VERSION 7 83 83 all 84 84 2 5 85 85 jari 86 86 2 5 87 CACHE FILE VERSION 687 CACHE FILE VERSION 7 88 88 all 89 89 90 90 jari 91 91 92 CACHE FILE VERSION 692 CACHE FILE VERSION 7 93 93 all 94 94 2 5 95 95 jari 96 96 2 5 97 CACHE FILE VERSION 697 CACHE FILE VERSION 7 98 98 all 99 99 2 7 100 100 jari 101 101 2 7 102 CACHE FILE VERSION 6102 CACHE FILE VERSION 7 -
branches/src-highlight/test/date_test.cc
r693 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 5 6 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/test/environment.h.in
r737 r1100 6 6 7 7 /* 8 Copyright (C) 2008 Peter Johansson8 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 9 9 10 10 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/test/parser_test.cc
r693 r1100 3 3 /* 4 4 Copyright (C) 2006 Peter Johansson 5 Copyright (C) 2007 Peter Johansson5 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/test/repo/db/current
r818 r1100 1 6 4 1y41 68 2s 4 -
branches/src-highlight/test/stats_test.cc
r744 r1100 3 3 /* 4 4 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson5 Copyright (C) 2009, 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 40 40 #include <vector> 41 41 42 using namespace theplu::svndigest; 43 42 44 namespace theplu{ 43 45 namespace svndigest{ … … 46 48 int linetype, const std::string& descr, const std::string& author); 47 49 std::string path(void); 48 bool test_add( void);49 bool test_blame( void);50 bool test_classic( void);50 bool test_add(test::Suite&); 51 bool test_blame(test::Suite&); 52 bool test_classic(test::Suite&); 51 53 bool test_base_class(const Stats&); 52 54 bool test_cache(const Stats&); … … 57 59 int main( int argc, char* argv[]) 58 60 { 59 using namespace theplu::svndigest;60 61 test::Suite suite(argc, argv, true); 61 62 … … 63 64 bool ok=true; 64 65 65 SVN* svn=SVN::instance( test::filename("toy_project"));66 SVN* svn=SVN::instance("toy_project"); 66 67 if (!svn){ 67 68 std::cerr << "error: cannot create SVN instance\n"; … … 69 70 } 70 71 71 ok &= test_add( );72 ok &= test_blame( );73 ok &= test_classic( );72 ok &= test_add(suite); 73 ok &= test_blame(suite); 74 ok &= test_classic(suite); 74 75 75 76 if (verbose) { … … 90 91 std::string path(void) 91 92 { 92 return test::filename("toy_project/bin/svnstat.cc"); 93 } 94 95 bool test_add(void) 96 { 93 return "toy_project/bin/svnstat.cc"; 94 } 95 96 bool test_add(test::Suite& suite) 97 { 98 suite.out() << "testing add\n"; 97 99 bool ok =true; 98 100 AddStats cs(path()); … … 140 142 141 143 142 bool test_blame(void) 143 { 144 bool test_blame(test::Suite& suite) 145 { 146 suite.out() << "testing blame\n"; 144 147 bool ok =true; 145 148 BlameStats cs(path()); … … 207 210 208 211 209 bool test_classic(void) 210 { 212 bool test_classic(test::Suite& suite) 213 { 214 suite.out() << "testing classic\n"; 211 215 bool ok =true; 212 216 ClassicStats cs(path()); … … 216 220 // testing copyright lines for peter 217 221 std::vector<int> correct(48,0); 218 correct[47]= 2;222 correct[47]=1; 219 223 ok &= check(cs, correct, LineTypeParser::copyright, "copyright", "peter"); 220 224 … … 253 257 correct[28]=31; 254 258 correct[30]=63; 255 correct[47]= 2;259 correct[47]=1; 256 260 ok &= check(cs, correct, LineTypeParser::total, "total", "all"); 257 261 -
branches/src-highlight/test/svn_update.sh.in
r772 r1100 4 4 # $Id$ 5 5 6 # Copyright (C) 2009 Peter Johansson 6 # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 7 # Copyright (C) 2009, 2010 Peter Johansson 7 8 # 8 9 # This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 21 22 # along with svndigest. If not, see <http://www.gnu.org/licenses/>. 22 23 23 rootdir=@abs_builddir@/toy_project 24 test -z "$SVN" && SVN=svn 25 rootdir=toy_project 24 26 25 27 if test ! -e $rootdir; then 26 28 repo="@abs_test_repo@"; 27 svn co file://$repo/trunk $rootdir > /dev/null;29 $SVN checkout file://$repo/trunk $rootdir; 28 30 fi 29 31 30 svn update $rootdir > /dev/null; 32 $SVN update $rootdir -
branches/src-highlight/test/trac_test.cc
r768 r1100 2 2 3 3 /* 4 Copyright (C) 2007, 2008, 2009 Peter Johansson 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest -
branches/src-highlight/test/utility_test.cc
r795 r1100 2 2 3 3 /* 4 Copyright (C) 2007 Peter Johansson5 Copyright (C) 200 8 Jari Häkkinen,Peter Johansson4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009, 2010 Peter Johansson 6 6 7 7 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 29 29 30 30 bool test_hex(int, unsigned int, std::string); 31 bool test_ equal(bool, std::string, std::string);31 bool test_fnmatch(bool, std::string, std::string); 32 32 bool test_regexp(bool, std::string, std::string, 33 33 const std::vector<std::string>&); … … 41 41 ok &= test_hex(16,2, "10"); 42 42 43 ok &= test_equal(true,"peter", "peter"); 44 ok &= test_equal(false,"peter", "peterj"); 45 ok &= test_equal(true,"p*", "peterj"); 46 ok &= test_equal(true,"peter", "p*"); 47 ok &= test_equal(false,"peter", "p*j"); 48 ok &= test_equal(true,"peter", "*peter"); 43 ok &= test_fnmatch(true,"peter", "peter"); 44 ok &= test_fnmatch(false,"peter", "peterj"); 45 46 ok &= test_fnmatch(true,"*", "peterj"); 47 ok &= test_fnmatch(true,"p*", "peterj"); 48 ok &= test_fnmatch(true, "p*", "peter"); 49 ok &= test_fnmatch(false, "p*j", "peter"); 50 ok &= test_fnmatch(true, "p*j", "peterj"); 51 ok &= test_fnmatch(true, "*peter", "peter"); 52 53 ok &= test_fnmatch(true, "p?ter", "peter"); 54 ok &= test_fnmatch(false, "p?er", "peter"); 55 ok &= test_fnmatch(false, "p?eter", "peter"); 56 57 ok &= test_fnmatch(true, "filename", "filename"); 58 ok &= test_fnmatch(true, "*name", "filename"); 59 ok &= test_fnmatch(true, "[fa]il?name", "filename"); 60 ok &= test_fnmatch(true, "[fa]*il?name", "ffilename"); 61 62 ok &= test_fnmatch(true, "[fa]*il?name", "fafafailename"); 63 ok &= test_fnmatch(false, "[fa]?il?name", "ilename"); 64 ok &= test_fnmatch(false, "?[fa]il?name", "ilename"); 65 ok &= test_fnmatch(true, "[fa]il?name", "filename"); 66 ok &= test_fnmatch(false, "[fa]?il?name", "fafafailename"); 67 68 ok &= test_fnmatch(true, "*name", "/path/to/filename"); 69 ok &= test_fnmatch(true, "*name", "file.name"); 70 // posix dictates that leading period can not be matched by 71 // wildcard, but here we allow match 72 ok &= test_fnmatch(true, "*.txt", ".file.txt"); 73 49 74 50 75 std::vector<std::string> vec; 51 76 ok &= test_regexp(true,"abcde", "abcde", vec); 77 vec.push_back("c"); 78 ok &= test_regexp(true,"ab?de", "abcde", vec); 79 vec[0] = "bcd"; 80 ok &= test_regexp(true,"a*e", "abcde", vec); 52 81 vec.push_back(""); 53 ok &= test_regexp(true,"abcde", "abcd?e", vec); 54 vec[0]="c"; 55 ok &= test_regexp(true,"abcde", "ab?de", vec); 56 vec[0] = "bcd"; 57 ok &= test_regexp(true,"abcde", "a*e", vec); 58 vec.push_back(""); 59 ok &= test_regexp(true,"abcddf", "a*d*f", vec); 82 ok &= test_regexp(true,"a*d*f", "abcddf", vec); 60 83 vec[0] = "bc"; 61 84 vec[1] = "ef"; 62 ok &= test_regexp(true,"a bcdefg", "a*d*g", vec);85 ok &= test_regexp(true,"a*d*g", "abcdefg", vec); 63 86 vec.push_back(""); 64 ok &= test_regexp(true,"abcdefg", "a*d*?g", vec); 87 vec[1]="e"; 88 vec[2]="f"; 89 ok &= test_regexp(true,"a*d*?g", "abcdefg", vec); 90 ok &= test_regexp(true,"a*d??g", "abcdefg", vec); 91 vec.resize(2); 92 vec[0]="f"; 93 vec[1]="e"; 94 ok &= test_regexp(true, "[fa]il?name", "filename", vec); 65 95 66 96 if (ok) … … 69 99 } 70 100 71 bool test_ equal(bool answ, std::string a, std::string b)101 bool test_fnmatch(bool answ, std::string a, std::string b) 72 102 { 73 if (theplu::svndigest::equal(a.begin(), a.end(), b.begin(), b.end())==answ) 103 using namespace theplu::svndigest; 104 bool res = fnmatch(a.c_str(), b.c_str()); 105 // check that fnmatch and regexp agree 106 std::vector<std::string> v; 107 bool res2 = regexp(a, b, v); 108 if (res == answ && res2==answ) 74 109 return true; 75 std::cerr << "equal(" << a << ", " << b << ") results " 76 << theplu::svndigest::equal(a.begin(), a.end(),b.begin(), b.end()) 77 << ". Expects " << answ << std::endl; 110 if (res!=answ) 111 std::cerr << "fnmatch(" << a << ", " << b << ") results " 112 << res 113 << ". Expects " << answ << std::endl; 114 if (res2!=answ) 115 std::cerr << "regexp(" << b << ", " << a << ") results " 116 << res2 117 << ". Expects " << answ << std::endl; 78 118 return false; 79 119 } … … 94 134 using namespace theplu::svndigest; 95 135 std::vector<std::string> v; 96 bool res = regexp(a .begin(), a.end(), b.begin(), b.end(), v);136 bool res = regexp(a, b, v); 97 137 if (res!=ans || v!=vec) { 98 138 std::cerr << "regexp(" << a << ", " << b << ") results " … … 107 147 } 108 148 return true; 109 110 149 }
Note: See TracChangeset
for help on using the changeset viewer.