Ignore:
Timestamp:
Apr 9, 2009, 10:18:54 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Merged trunk changes r645:782 to replacing_gnuplot branch.

Location:
branches/replacing_gnuplot
Files:
3 deleted
94 edited
26 copied

Legend:

Unmodified
Added
Removed
  • branches/replacing_gnuplot

    • Property svn:ignore
      •  

        old new  
        88autom4te.cache
        99INSTALL
        10 COPYING
        1110aclocal.m4
        1211Makefile
  • branches/replacing_gnuplot/.svndigest/config

    r521 r784  
    33### The commented-out below are intended to demonstrate how to use
    44### this file.
     5
     6### Section for setting behaviour of copyright update
     7[copyright]
     8# if true svndigest will warn if file has no copyright statement.
     9missing-copyright-warning = no
    510
    611### Section for setting aliases used in copyright update
     
    1318[trac]
    1419# If trac-root is set, svndigest will create anchors to the Trac page.
    15 # trac-root = http://trac.thep.lu.se/svndigest/
    16 trac-root = http://trac.thep.lu.se/svndigest/
     20# trac-root = http://dev.thep.lu.se/svndigest/
     21trac-root = http://dev.thep.lu.se/svndigest/
    1722
    1823### Section for setting dictionary for file names.
    19 ### Prior looking for file name pattern in section [codon],
     24### Prior looking for file name pattern in section [parsing-codons],
    2025### the file name may be translated according to the rules
    2126### in this section. In default setting there is, for example,
     
    3742[parsing-codons]
    3843*.ac = "#":"\n"  ;  "dnl":"\n"
    39 *.am = "#":"\n"  ;  "dnl":"\n"
     44*.am = "#":"\n"
    4045*.m4 = "#":"\n"  ;  "dnl":"\n"
    4146*.c = "//":"\n"  ;  "/*":"*/"
  • branches/replacing_gnuplot/AUTHORS

    r646 r784  
    22
    33Copyright (C) 2005, 2006, 2008 Jari Häkkinen
     4Copyright (C) 2007, 2008 Peter Johansson
    45
    56Files are copyright by their respective authors. The contributions to
     
    78source code revision system.
    89
    9 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112svndigest is free software; you can redistribute it and/or modify it
    1213under the terms of the GNU General Public License as published by the
    13 Free Software Foundation; either version 2 of the License, or (at your
     14Free Software Foundation; either version 3 of the License, or (at your
    1415option) any later version.
    1516
     
    2021
    2122You should have received a copy of the GNU General Public License
    22 along with this program; if not, write to the Free Software
    23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    24 USA.
     23along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524
    2625
  • branches/replacing_gnuplot/ChangeLog

    r588 r784  
    44Copyright (C) 2005, 2006 Jari Häkkinen
    55Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    6 Copyright (C) 2008 Peter Johansson
     6Copyright (C) 2008, 2009 Peter Johansson
    77
    8 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8This file is part of svndigest, http://dev.thep.lu.se/svndigest
    99
    1010svndigest is free software; you can redistribute it and/or modify it
    1111under the terms of the GNU General Public License as published by the
    12 Free Software Foundation; either version 2 of the License, or (at your
     12Free Software Foundation; either version 3 of the License, or (at your
    1313option) any later version.
    1414
     
    1919
    2020You should have received a copy of the GNU General Public License
    21 along with this program; if not, write to the Free Software
    22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    23 USA.
     21along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2422}}}
    2523----------------------------------------------------------------------
     
    2927
    3028version 0.7:
    31   - http://trac.thep.lu.se/svndigest/log/trunk?rev=HEAD&stop_rev=418
    32   - http://trac.thep.lu.se/svndigest/query?milestone=0.7&order=id
     29  - http://dev.thep.lu.se/svndigest/log/trunk?rev=HEAD&stop_rev=418
     30  - http://dev.thep.lu.se/svndigest/query?milestone=0.7&order=id
     31
     32version 0.6.7:
     33  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=765&stop_rev=687
     34  - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.7&order=id
     35
     36version 0.6.6:
     37  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=685&stop_rev=577
     38  - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.6&order=id
    3339
    3440version 0.6.5:
    35   - http://trac.thep.lu.se/svndigest/log/branches/0.6-stable?rev=575&stop_rev=491
    36   - http://trac.thep.lu.se/svndigest/query?milestone=0.6.5&order=id
     41  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=575&stop_rev=491
     42  - http://dev.thep.lu.se/svndigest/query?milestone=svndigest+0.6.5&order=id
    3743
    3844version 0.6.4:
    39   - http://trac.thep.lu.se/svndigest/log/branches/0.6-stable?rev=489&stop_rev=474
    40   - http://trac.thep.lu.se/svndigest/query?milestone=0.6.4&order=id
     45  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=489&stop_rev=474
     46  - http://dev.thep.lu.se/svndigest/query?milestone=0.6.4&order=id
    4147
    4248version 0.6.3:
    43   - http://trac.thep.lu.se/svndigest/log/branches/0.6-stable?rev=472&stop_rev=460
    44   - http://trac.thep.lu.se/svndigest/query?milestone=0.6.3&order=id
     49  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=472&stop_rev=460
     50  - http://dev.thep.lu.se/svndigest/query?milestone=0.6.3&order=id
    4551
    4652version 0.6.2:
    47   - http://trac.thep.lu.se/svndigest/log/branches/0.6-stable?rev=459&stop_rev=438
    48   - http://trac.thep.lu.se/svndigest/query?milestone=0.6.2&order=id
     53  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=459&stop_rev=438
     54  - http://dev.thep.lu.se/svndigest/query?milestone=0.6.2&order=id
    4955
    5056version 0.6.1:
    51   - http://trac.thep.lu.se/svndigest/log/branches/0.6-stable?rev=437&stop_rev=417
    52   - http://trac.thep.lu.se/svndigest/query?milestone=0.6.1&order=id
     57  - http://dev.thep.lu.se/svndigest/log/branches/0.6-stable?rev=437&stop_rev=417
     58  - http://dev.thep.lu.se/svndigest/query?milestone=0.6.1&order=id
    5359
    5460version 0.6:
    55   - http://trac.thep.lu.se/svndigest/log/trunk?rev=413&stop_rev=195
    56   - http://trac.thep.lu.se/svndigest/query?milestone=0.6&order=id
     61  - http://dev.thep.lu.se/svndigest/log/trunk?rev=413&stop_rev=195
     62  - http://dev.thep.lu.se/svndigest/query?milestone=0.6&order=id
    5763
    5864version 0.5:
    59   - http://trac.thep.lu.se/svndigest/log/trunk?rev=194&stop_rev=151
    60   - http://trac.thep.lu.se/svndigest/query?milestone=0.5&order=id
     65  - http://dev.thep.lu.se/svndigest/log/trunk?rev=194&stop_rev=151
     66  - http://dev.thep.lu.se/svndigest/query?milestone=0.5&order=id
    6167
    6268version 0.4:
    63   - http://trac.thep.lu.se/svndigest/log/trunk?rev=150&stop_rev=148
     69  - http://dev.thep.lu.se/svndigest/log/trunk?rev=150&stop_rev=148
    6470
    6571version 0.3:
    66   - http://trac.thep.lu.se/svndigest/log/trunk?rev=147&stop_rev=83
    67   - http://trac.thep.lu.se/svndigest/query?milestone=0.3&order=id
     72  - http://dev.thep.lu.se/svndigest/log/trunk?rev=147&stop_rev=83
     73  - http://dev.thep.lu.se/svndigest/query?milestone=0.3&order=id
    6874
    6975version 0.1 and 0.2:
    70   - http://trac.thep.lu.se/svndigest/log/trunk?rev=82&stop_rev=1
    71   - http://trac.thep.lu.se/svndigest/query?milestone=0.2&order=id
    72   - http://trac.thep.lu.se/svndigest/query?milestone=0.1&order=id
     76  - http://dev.thep.lu.se/svndigest/log/trunk?rev=82&stop_rev=1
     77  - http://dev.thep.lu.se/svndigest/query?milestone=0.2&order=id
     78  - http://dev.thep.lu.se/svndigest/query?milestone=0.1&order=id
  • branches/replacing_gnuplot/Makefile.am

    r569 r784  
    44
    55# Copyright (C) 2005, 2006 Jari Häkkinen
    6 # Copyright (C) 2007 2008 Peter Johansson
     6# Copyright (C) 2007, 2008 Peter Johansson
    77#
    8 # This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8# This file is part of svndigest, http://dev.thep.lu.se/svndigest
    99#
    1010# svndigest is free software; you can redistribute it and/or modify it
    1111# under the terms of the GNU General Public License as published by
    12 # the Free Software Foundation; either version 2 of the License, or
     12# the Free Software Foundation; either version 3 of the License, or
    1313# (at your option) any later version.
    1414#
     
    1919#
    2020# You should have received a copy of the GNU General Public License
    21 # along with this program; if not, write to the Free Software
    22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    23 # 02111-1307, USA.
     21# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2422
    25 SUBDIRS = lib bin test
     23# -I arg should be the same as arg in AC_CONFIG_MACRO_DIR in configure.ac
     24ACLOCAL_AMFLAGS = -I m4 --install
     25
     26SUBDIRS = lib bin man test
    2627
    2728EXTRA_dist = build_support/move-if-change
     
    2930clean-local:
    3031  rm -rf svndigest *~
     32
     33if ENABLE_SVN_SUPPORT
     34include build_support/svn_support.am
     35endif
     36
     37
     38# This is a workaround to avoid a broken make when .m4 files are
     39# renamed or deleted. Something similar will be provided by Automake 1.11
     40$(am__aclocal_m4_deps):
  • branches/replacing_gnuplot/NEWS

    r580 r784  
    44
    55Version 0.7 (released DATE)
     6  - Upgraded to GLPv3 (ticket:339)
     7  - configure option --enable-staticbin is removed (ticket:340)
    68  - configure option --enable-wctests is removed (ticket:295)
    79  - parsing rules can be set in config file (ticket:283)
    810
    911  A complete list of closed tickets can be found here [[br]]
    10   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.7
     12  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.7
     13
     14version 0.6.7 (released 1 February 2009)
     15  - Improved TracLinks (issue #353)
     16  - Daylight saving time is now handled correctly (issue #353)
     17
     18  A complete list of closed tickets can be found here [[br]]
     19  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=svndigest+0.6.7
     20
     21version 0.6.6 (released 4 August 2008)
     22  - Improved removal of sub-directory in --target dir (ticket:242 ticket:243)
     23  - References were changed to http://dev.thep.lu.se/svndigest
     24
     25  A complete list of closed tickets can be found here [[br]]
     26  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=svndigest+0.6.6
    1127
    1228version 0.6.5 (released 18 March 2008)
     
    1531
    1632  A complete list of closed tickets can be found here [[br]]
    17   http://trac.thep.lu.se/trac/svndigest/query?status=closed&milestone=0.6.5
     33  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=svndigest+0.6.5
    1834
    1935version 0.6.4 (released 14 October 2007)
     
    2238
    2339  A complete list of closed tickets can be found here [[br]]
    24   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.6.4
     40  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.6.4
    2541
    2642version 0.6.3 (released 31 August 2007)
     
    2945
    3046  A complete list of closed tickets can be found here [[br]]
    31   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.6.3
     47  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.6.3
    3248
    3349Version 0.6.2 (released 21 August 2007)
     
    3551
    3652  A complete list of closed tickets can be found here [[br]]
    37   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.6.2
     53  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.6.2
    3854
    3955Version 0.6.1 (released 9 July 2007)
    40   - changed refs to svndigest site to http://trac.thep.lu.se/svndigest
     56  - changed refs to svndigest site to http://dev.thep.lu.se/svndigest
    4157  - fixed lineover bug in blame output (ticket:235)
    4258
    4359  A complete list of closed tickets can be found here [[br]]
    44   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.6.1
     60  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.6.1
    4561
    4662Version 0.6 (released 29 June 2007)
     
    5571
    5672  A complete list of closed tickets can be found here [[br]]
    57   http://trac.thep.lu.se/svndigest/query?status=closed&milestone=0.6
     73  http://dev.thep.lu.se/svndigest/query?status=closed&milestone=0.6
    5874
    5975Version 0.5 (released 7 September 2006)
     
    86102Copyright (C) 2005, 2006 Jari Häkkinen
    87103Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    88 Copyright (C) 2008 Peter Johansson
     104Copyright (C) 2008, 2009 Peter Johansson
    89105
    90 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     106This file is part of svndigest, http://dev.thep.lu.se/svndigest
    91107
    92108svndigest is free software; you can redistribute it and/or modify it
    93109under the terms of the GNU General Public License as published by the
    94 Free Software Foundation; either version 2 of the License, or (at your
     110Free Software Foundation; either version 3 of the License, or (at your
    95111option) any later version.
    96112
     
    101117
    102118You should have received a copy of the GNU General Public License
    103 along with this program; if not, write to the Free Software
    104 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
     119along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    105120USA.
    106121}}}
  • branches/replacing_gnuplot/README

    r646 r784  
    2727svndigest can be obtained from
    2828
    29   http://trac.thep.lu.se/svndigest/wiki/DownloadPage
     29  http://dev.thep.lu.se/svndigest/wiki/DownloadPage
    3030
    3131
     
    7575svndigest. You can provide `./configure` with APR and subversion API
    7676location information with `--with-apr=DIR` and `--with-svn=DIR`,
    77 respectively. `--enable-staticbin` will create a static
    78 svndigest binary. (Actually as static as the underlying program
    79 libraries allows it to be, i.e., some external libraries might not
    80 have been created/installed in static versions.)
     77respectively.
    8178
    8279If you grabbed the source from the subversion repository you need to
     
    8885The development of svndigest can be monitored through
    8986
    90   http://trac.thep.lu.se/svndigest
     87  http://dev.thep.lu.se/svndigest
    9188
    9289You can find most information concerning the development of svndigest at
     
    9895You can report svndigest bugs on
    9996
    100   http://trac.thep.lu.se/svndigest/newticket
     97  http://dev.thep.lu.se/svndigest/newticket
    10198
    10299Use user `svndigest` and password `svndigest`.
     
    108105access, issue:
    109106
    110   `svn checkout http://lev.thep.lu.se/repository/svndigest/trunk svndigest`
     107  `svn checkout http://dev.thep.lu.se/svndigest/svn/trunk svndigest`
    111108
    112109See file README.developer for developer specific information. We make no
     
    119116{{{
    120117Copyright (C) 2005, 2006 Jari Häkkinen
    121 Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    122 Copyright (C) 2008 Jari Häkkinen
     118Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    123119
    124 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     120This file is part of svndigest, http://dev.thep.lu.se/svndigest
    125121
    126122svndigest is free software; you can redistribute it and/or modify it
    127123under the terms of the GNU General Public License as published by the
    128 Free Software Foundation; either version 2 of the License, or (at your
     124Free Software Foundation; either version 3 of the License, or (at your
    129125option) any later version.
    130126
     
    135131
    136132You should have received a copy of the GNU General Public License
    137 along with this program; if not, write to the Free Software
    138 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    139 USA.
     133along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    140134}}}
    141 
    142 
  • branches/replacing_gnuplot/README.developer

    r583 r784  
    2020We follow these guidelines.
    2121
     22
     23=== Requirements ===
     24
     25To build from a subversion checkout, you will need Autotools. More
     26specifically Automake 1.10 (or later) and Autoconf 2.61 (or later). To
     27build man page you will need help2man.
    2228
    2329=== bootstrap and autoreconf ===
     
    121127== Releasing ==
    122128
    123 See http://trac.thep.lu.se/svndigest/wiki/ReleaseProcedure
     129See http://dev.thep.lu.se/svndigest/wiki/ReleaseProcedure
    124130
    125131
     
    130136Copyright (C) 2008 Peter Johansson
    131137
    132 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     138This file is part of svndigest, http://dev.thep.lu.se/svndigest
    133139
    134140svndigest is free software; you can redistribute it and/or modify it
    135141under the terms of the GNU General Public License as published by the
    136 Free Software Foundation; either version 2 of the License, or (at your
     142Free Software Foundation; either version 3 of the License, or (at your
    137143option) any later version.
    138144
     
    143149
    144150You should have received a copy of the GNU General Public License
    145 along with this program; if not, write to the Free Software
    146 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    147 USA.
    148 
     151along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    149152}}}
  • branches/replacing_gnuplot/THANKS

    r569 r784  
    1818the generated CSS file, svndigest.css.
    1919
    20 During the build process svndigest automagically incorporate its
     20During the build process svndigest automagically incorporates its
    2121current svn revision into the source and binary. The solution, based
    22 on a suggested by Markus Hoenicka, works both when being in a
     22on a suggestion from Markus Hoenicka, works both when being in a
    2323subversion WC (using svnversion) and when being outside. Hoenicka's
    2424suggestion can be found here:
     
    3535Copyright (C) 2008 Peter Johansson
    3636
    37 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     37This file is part of svndigest, http://dev.thep.lu.se/svndigest
    3838
    3939svndigest is free software; you can redistribute it and/or modify it
    4040under the terms of the GNU General Public License as published by the
    41 Free Software Foundation; either version 2 of the License, or (at your
     41Free Software Foundation; either version 3 of the License, or (at your
    4242option) any later version.
    4343
     
    4848
    4949You should have received a copy of the GNU General Public License
    50 along with this program; if not, write to the Free Software
    51 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    52 USA.
    53 
     50along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    5451}}}
    55 
  • branches/replacing_gnuplot/bin/Makefile.am

    r646 r784  
    66# Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    77# Copyright (C) 2007, 2008 Peter Johansson
     8# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    89#
    9 # This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10# This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011#
    1112# svndigest is free software; you can redistribute it and/or modify it
    1213# under the terms of the GNU General Public License as published by
    13 # the Free Software Foundation; either version 2 of the License, or
     14# the Free Software Foundation; either version 3 of the License, or
    1415# (at your option) any later version.
    1516#
     
    2021#
    2122# You should have received a copy of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24 # 02111-1307, USA.
     23# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524
    2625bin_PROGRAMS = svndigest
     
    3029noinst_HEADERS = Parameter.h
    3130
    32 LDADD = @top_builddir@/lib/libsvndigest.la $(SVNDIGEST_LIBS)
    33 AM_LDFLAGS = $(STATICFLAG) $(SVNDIGEST_LDFLAGS)
     31LDADD = $(top_builddir)/lib/libsvndigest.a $(SVNDIGEST_LIBS)
     32AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
    3433
    35 AM_CPPFLAGS = -I@top_srcdir@/lib $(SVNDIGEST_CPPFLAGS)
     34AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS)
    3635AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS)
    3736
    3837
    39 # install versioned binary (excluding patch version)
    40 install-exec-hook:
    41   cd $(DESTDIR)$(bindir) && \
    42   mv -f svndigest$(EXEEXT) \
    43   svndigest-$(MAJOR_VERSION).$(MINOR_VERSION)$(EXEEXT) && \
    44   $(LN_S) svndigest-$(MAJOR_VERSION).$(MINOR_VERSION)$(EXEEXT) svndigest$(EXEEXT)
    45 
    46 uninstall-hook:
    47   cd $(DESTDIR)$(bindir) && \
    48   rm -f svndigest-$(MAJOR_VERSION).$(MINOR_VERSION)$(EXEEXT)
    49 
    5038clean-local:
    5139  rm -rf *~
  • branches/replacing_gnuplot/bin/Parameter.cc

    r646 r784  
    22
    33/*
    4   Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2008 Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     4  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    87
    98  svndigest is free software; you can redistribute it and/or modify it
    109  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1211  (at your option) any later version.
    1312
     
    1817
    1918  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2320*/
    2421
     
    2623
    2724#include "ColumnStream.h"
    28 #include "subversion_info.h"
     25#include "OptionArg.h"
     26#include "OptionHelp.h"
     27#include "OptionSwitch.h"
     28#include "OptionVersion.h"
    2929#include "utility.h"
    3030#include <config.h> // this header file is created by configure
    3131
     32#include <cassert>
     33#include <cerrno>
    3234#include <cstddef>
     35#include <cstring>
    3336#include <fstream>
    3437#include <iostream>
     
    4245
    4346  Parameter::Parameter( int argc, char *argv[])
    44     : config_file_(""), copyright_(false), force_(false),
    45       generate_config_(false), ignore_cache_(false), report_(true),
    46       revisions_(false), root_("."), root_node_("."), targetdir_("."),
    47       verbose_(false)
    48   {
    49     for (int i=1; i<argc; ++i) {
    50       std::stringstream ss(argv[i]);
    51       std::string myargv("");
    52       std::string value("");
    53       getline(ss, myargv, '=');
    54       getline(ss, value);
    55 
    56       if (myargv=="--config-file"){
    57         if (value.size()) {
    58           config_file_.value()= value;
     47    : cmd_(
     48     "Mandatory arguments to long options are mandatory for short options too.")
     49  {
     50    init();
     51    try {
     52      cmd_.parse(argc, argv);
     53    }
     54    catch (cmd_error& e) {
     55      std::cerr << e.what() << std::endl;
     56      exit (-1);
     57    }
     58
     59    // set default values
     60    if (!root_->present())
     61      root_->value(".");
     62
     63    if (!target_->present())
     64      target_->value(".");
     65
     66    if (!config_file_->present())
     67      config_file_->value(concatenate_path(root_->value(),".svndigest/config"));
     68
     69    // analyse arguments
     70    analyse();
     71  }
     72
     73
     74  Parameter::~Parameter(void)
     75  {
     76    delete config_file_;
     77    delete copyright_;
     78    delete force_;
     79    delete generate_config_;
     80    delete help_;
     81    delete ignore_cache_;
     82    delete report_;
     83    delete revisions_;
     84    delete root_;
     85    delete target_;
     86    delete verbose_;
     87    delete version_;
     88  }
     89
     90
     91  void Parameter::analyse(void)
     92  {
     93    std::string save_wd = pwd();
     94
     95    // check root but not if -g option given
     96    if (!generate_config()) {
     97      check_existence(root_->value());
     98      check_readable(root_->value());
     99      if (chdir(root_->value().c_str())) {
     100        std::stringstream ss;
     101        ss << "svndigest: cannot read `" << root_->value() << "': "
     102           << strerror(errno);
     103        throw cmd_error(ss.str());
     104      }
     105      root_->value(pwd());
     106      chdir(save_wd.c_str());
     107
     108      // check target (only if we write report)
     109      if (report()) {
     110        check_existence(target_->value());
     111        check_readable(target_->value());
     112        std::string base_root = file_name(root_->value());
     113        std::string path = concatenate_path(target_->value(),base_root);
     114        if (access_rights(target_->value().c_str(), "w")) {
     115          std::stringstream ss;
     116          ss << "svndigest: cannot create directory `" << path
     117             << "': " << strerror(errno);
     118          throw cmd_error(ss.str());
    59119        }
    60         else if (++i<argc){
    61           config_file_.value()= std::string(argv[i]);
     120        if (node_exist(path) && !force()) {
     121          std::stringstream ss;
     122          ss << "svndigest: cannot create directory `" << path << "' "
     123             << strerror(EEXIST);
     124          throw cmd_error(ss.str());
    62125        }
    63         else {
    64           missing_argument(myargv);
     126        if (chdir(target_->value().c_str())) {
     127          std::stringstream ss;
     128          ss << "svndigest: cannot read `" << target_->value() << "': "
     129             << strerror(errno);
     130          throw cmd_error(ss.str());
    65131        }
     132        target_->value(pwd());
     133        chdir(save_wd.c_str());
    66134      }
    67       else if (myargv=="--copyright"){
    68           copyright_.value()=true;
     135    }
     136
     137    // check config file
     138    struct stat nodestat;
     139    // true also if there is a broken symlink named...
     140    bool config_exists = !lstat(config_file_->value().c_str(), &nodestat);
     141    // the latter case in order to catch broken symlink
     142    if (config_file_->present() || config_exists)
     143      // throws if file does not exists
     144      check_existence(config_file_->value());
     145    if (config_exists) {
     146      // throws if file is not readable
     147      check_readable(config_file_->value());
     148      stat(config_file_->value().c_str(), &nodestat);
     149      if (!S_ISREG(nodestat.st_mode)) {
     150        std::stringstream ss;
     151        ss << "svndigest: `" << config_file_->value()
     152           << "' is not a regular file";
     153        throw cmd_error(ss.str());
    69154      }
    70       else if (myargv=="-f" || myargv=="--force"){
    71           force_.value()=true;
    72       }
    73       else if (myargv=="-g" || myargv=="--generate-config"){
    74           generate_config_.value()=true;
    75       }
    76       else if (myargv=="-h" || myargv=="--help"){
    77         help();
    78         exit(0);      // always exit after printing help
    79       }
    80       else if (myargv=="--ignore-cache"){
    81           ignore_cache_.value()=true;
    82       }
    83       else if (myargv=="-r" || myargv=="--root"){
    84         if (value.size()) {
    85           root_.value()= value;
    86         }
    87         else if (++i<argc){
    88           root_.value()= std::string(argv[i]);
    89         }
    90         else {
    91           missing_argument(myargv);
    92         }
    93       }
    94       else if (myargv=="--report") {
    95           report_.value()=true;
    96       }
    97       else if (myargv=="--no-report") {
    98           report_.value()=false;
    99       }
    100       else if (myargv=="--revisions") {
    101           revisions_.value()=true;
    102       }
    103       else if (myargv=="-t" || myargv=="--target"){
    104         if (value.size()) {
    105           targetdir_.value()= value;
    106         }
    107         else if (++i<argc){
    108           targetdir_.value()= std::string(argv[i]);
    109         }
    110         else {
    111           missing_argument(myargv);
    112         }
    113       }
    114       else if (myargv=="-v" || myargv=="--verbose"){
    115           verbose_.value()=true;
    116       }
    117       else if (myargv=="--version"){
    118         version();
    119         exit(0);
    120       }
    121       else if (myargv=="-vf" || myargv=="-fv"){
    122           verbose_.value()=true;
    123           force_.value()=true;
    124       }
    125       else {
    126         throw std::runtime_error("svndigest: invalid option: " + myargv +
    127                                  "\nTry `svndigest --help' for usage.");
    128       }
    129   }
    130 
    131     analyse();
    132   }
    133 
    134 
    135   void Parameter::analyse(void)
    136   {
    137     using namespace std;
    138 
    139     string workdir(pwd()); // remember current working directory (cwd).
    140 
    141     if (!node_exist(root_.value()))
    142       throw runtime_error(string("svndigest: cannot stat `" + root_.value() +
    143                                  "': no such file or directory"));
    144 
    145     if (access_rights(root_.value(), "r"))
    146       throw runtime_error(string("svndigest: cannot open `" + root_.value() +
    147                                  "' for reading: Permission denied"));
    148 
    149     // Check whether root is directory or file
    150     struct stat nodestat;
    151     stat(root_.value().c_str(), &nodestat);
    152     if (S_ISDIR(nodestat.st_mode)) {
    153       chdir(root_.value().c_str());
    154       root_node_.value() = root_.value() = pwd();
    155     }
    156     else {
    157       std::string fname = file_name(root_.value());
    158       root_.value() = directory_name(root_.value());
    159       chdir(root_.value().c_str());
    160       root_.value() = pwd();
    161       root_node_.value() = root_.value() + "/" + fname;
    162     }
    163 
    164     // need to get back to cwd if relative paths are used.
    165     if (chdir(workdir.c_str()))
    166       runtime_error(string("svndigest: Failed to access cwd: ") + workdir);
    167 
    168     // Checking that targetdir_ exists and retrieve the absolute path
    169     // to targetdir_
    170     if (report()) {
    171       if (chdir(targetdir_.value().c_str()))
    172         throw runtime_error(string("svndigest: Target directory (") +
    173                             targetdir_.value() + ") access failed.");
    174       targetdir_.value() = pwd();
    175       // Checking write permissions for targetdir_
    176       if (access_rights(targetdir_.value(),"w"))
    177         throw runtime_error(string("svndigest: No write permission on target ") +
    178                             "directory (" + targetdir_.value() +").");
    179     }
    180 
    181     // return back to cwd
    182     if (chdir(workdir.c_str()))
    183       throw runtime_error(string("svndigest: Failed to access cwd: ") + workdir);
    184 
    185   }
    186 
     155    }
     156  }
     157
     158
     159  void Parameter::check_existence(std::string path) const
     160  {
     161    if (node_exist(path))
     162      return;
     163    std::stringstream ss;
     164    ss << "svndigest: cannot stat `" << path << "': " << strerror(errno);
     165    throw cmd_error(ss.str());
     166  }
     167
     168 
     169  void Parameter::check_readable(std::string path) const
     170  {
     171    if (!access_rights(path, "r"))
     172      return;
     173    std::stringstream ss;
     174    ss << "svndigest: cannot open `" << path << "': " << strerror(errno);
     175    throw cmd_error(ss.str());
     176  }
     177 
    187178
    188179  std::string Parameter::config_file(void) const
    189180  {
    190     // not default
    191     if (!config_file_.value().empty())
    192       return config_file_.value();
     181    return config_file_->value();
     182  }
     183
     184
     185  bool Parameter::copyright(void) const
     186  {
     187    return copyright_->present();
     188  }
     189
     190
     191  bool Parameter::force(void) const
     192  {
     193    return force_->present();
     194  }
     195
     196
     197  bool Parameter::generate_config(void) const
     198  {
     199    return generate_config_->present();
     200  }
     201
     202
     203  bool Parameter::ignore_cache(void) const
     204  {
     205    return ignore_cache_->present();
     206  }
     207
     208
     209  void Parameter::init(void)
     210  {
     211    // don't use argv[0] because user may rename the binary
     212    cmd_.program_name() = PACKAGE_NAME;
     213    config_file_=new OptionArg<std::string>(cmd_, "config-file",
     214                                "configuration file [<ROOT>/.svndigest/config]");
     215    config_file_->print_arg("=FILE");
     216    std::stringstream ss;
     217    copyright_ = new OptionSwitch(cmd_, "copyright",
     218                                  "update copyright statement");
     219
     220    ss << "if sub-directory named <ROOT> exists in target directory, remove "
     221       << "sub-directory before writing results";
     222    force_ = new OptionSwitch(cmd_, "f,force", ss.str());
     223    ss.str("");
     224
     225    help_ = new OptionHelp(cmd_);
     226    generate_config_ =
     227      new OptionSwitch(cmd_, "g,generate-config",
     228                       "write configuration file to standard output");
     229
     230    ss.str("");
     231    ss << "ignore cache files and analyze everything from repository";
     232    ignore_cache_ = new OptionSwitch(cmd_, "ignore-cache", ss.str());
     233         
     234    report_ = new OptionSwitch(cmd_, "report", "create no HTML report", true);
     235
     236    ss.str("");
     237    ss << "use revision numbers as time scale instead of dates [dates]";
     238    revisions_ = new OptionSwitch(cmd_, "revisions", ss.str());
     239
     240    root_=
     241      new OptionArg<std::string>(cmd_, "r,root",
     242                     "svn controlled directory to perform statistics on [.]");
     243    root_->print_arg("=ROOT");
     244    target_ = new OptionArg<std::string>(cmd_, "t,target",
     245                                         "output directory [.]");
     246    target_->print_arg("=TARGET");
    193247   
    194     // default behaviour
    195     return root()+"/.svndigest/config";
    196   }
    197 
    198 
    199   void Parameter::help(void) const
    200   {
    201     ColumnStream cs(std::cout, 1);
    202     cs.width(0)=79;
    203     cs.margin(0)=0;
    204     ColumnStream cs2(std::cout, 2);
    205     // Widest line should fit exactly
    206     cs2.width(0)=21;
    207     cs2.width(1)=52;
    208     cs2.margin(0)=2;
    209     // Gnits standard suggest three characters gap between option and description
    210     cs2.margin(1)=3;
    211 
    212     std::cout << "Usage: svndigest [OPTION]...\n"
    213               << "\n";
    214 
    215     cs << "Generate statistical report for a subversion repository.\n";
    216 
    217     cs << "\nMandatory arguments to long options are mandatory for "
    218        << "short options too.\n";
    219 
    220     cs2  << "    --config-file=ARG\tconfiguration file "
    221          << "[<ROOT>/.svndigest/config]\n"
    222          << "    --copyright\tupdate copyright statement\n"
    223          << "-f, --force\tif sub-directory named <ROOT> exists in "
    224          << "target directory, remove sub-directory before writing results\n"
    225          << "-g, --generate-config\twrite configuration file "
    226          << "to standard output and exit\n"
    227          << "-h, --help\tdisplay this help and exit\n"
    228          << "    --ignore-cache\tignore cache files and analyze "
    229          << "everything from repository\n"
    230          << "    --no-report\tcreate no HTML report\n"
    231          << "    --revisions\tuse revision numbers as time scale "
    232          << "instead of dates [dates]\n"
    233          << "-r, --root=ROOT\tsvn controlled directory to perform "
    234          << "statistics calculation on [" << root_.default_value() << "]\n"
    235          << "-t, --target=TARGET\toutput directory ["
    236          << targetdir_.default_value() << "]\n"
    237          << "-v, --verbose\texplain what is being done\n"
    238          << "    --version\tprint version information and exit\n";
    239 
    240     std::cout << "\nReport bugs to <" << PACKAGE_BUGREPORT << ">."
    241               << std::endl;
    242   }
    243 
    244 
    245   void Parameter::missing_argument(std::string opt) const
    246   {
    247     if (opt.size()>0 && opt[0]=='-')
    248       opt = opt.substr(1);
    249     if (opt.size()>0 && opt[0]=='-')
    250       opt = opt.substr(1);
    251     std::stringstream ss;
    252     ss << "svndigest: option requires an argument -- " << opt << "\n"
    253        << "Try `svndigest --help' for usage.";
    254     throw std::runtime_error(ss.str());
    255   }
    256 
    257   void Parameter::version(bool verbose) const
    258   {
    259     ColumnStream cs(std::cout, 1);
    260     cs.width(0)=79;
    261     cs << PACKAGE_STRING << version_string() << "\n";
    262     cs << "\nCopyright (C) " << svn_year()
    263        << " Jari H\u00E4kkinen and Peter Johansson.\n"
    264        << "This is free software. You may redistribute copies of it under "
    265        << "the terms of the GNU General Public License "
    266        << "<http://www.gnu.org/licenses/gpl.html>.\n"
    267        << "There is NO WARRANTY; to the extent permitted by law.\n";
    268   }
     248    verbose_ = new OptionSwitch(cmd_, "v,verbose", "explain what is being done");
     249    version_ = new OptionVersion(cmd_, "version",
     250                                 "print version information and exit", verbose_);
     251
     252    ss.str("");
     253    ss << "Report bugs to " << PACKAGE_BUGREPORT << ".\n";
     254    help_->post_arguments() = ss.str();
     255    help_->synopsis() =
     256      "Generate statistical report for a subversion repository\n";
     257  }
     258
     259
     260  bool Parameter::report(void) const
     261  {
     262    return report_->value();
     263  }
     264
     265
     266  bool Parameter::revisions(void) const
     267  {
     268    return revisions_->present();
     269  }
     270
     271
     272  std::string Parameter::root(void) const
     273  {
     274    return root_->value();
     275  }
     276
     277 
     278  std::string Parameter::targetdir(void) const
     279  {
     280    return target_->value();
     281  }
     282
     283 
     284  bool Parameter::verbose(void) const
     285  {
     286    return verbose_->present();
     287  }
     288
    269289
    270290}} // of namespace svndigest and namespace theplu
  • branches/replacing_gnuplot/bin/Parameter.h

    r646 r784  
    66/*
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2007 Peter Johansson
     8  Copyright (C) 2007, 2008 Peter Johansson
    99
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1111
    1212  svndigest is free software; you can redistribute it and/or modify it
    1313  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1515  (at your option) any later version.
    1616
     
    2121
    2222  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2624*/
    2725
    28 #include "Option.h"
     26#include "CommandLine.h"
     27#include "OptionArg.h"
    2928
    30 #include <map>
    3129#include <string>
    3230
     
    3432namespace svndigest {
    3533
     34  class OptionHelp;
     35  class OptionSwitch;
     36  class OptionVersion;
     37
    3638  // class for command line options.
    3739  class Parameter {
    3840  public:
    3941    Parameter( int argc, char *argv[]);
     42    virtual ~Parameter(void);
    4043    std::string config_file(void) const;
    41     inline bool copyright(void) const { return copyright_.value(); }
    42     /// @todo
    43     inline bool force(void) const { return force_.value(); }
    44     inline bool generate_config(void) const { return generate_config_.value(); }
    45     // Until we fix caching (#313) ignore caching
    46     //inline bool ignore_cache(void) const { return ignore_cache_.value(); }
    47     inline bool ignore_cache(void) const { return true; }
    48     inline bool report(void) const { return report_.value(); }
    49     inline bool revisions(void) const { return revisions_.value(); }
     44   
     45    bool copyright(void) const;
     46    bool force(void) const;
     47    bool generate_config(void) const ;
     48    bool ignore_cache(void) const;
     49    bool report(void) const;
     50    bool revisions(void) const;
    5051    /// @return absolute path to root directory
    51     inline const std::string& root(void) const { return root_.value(); }
    52     /// @return absolute path to root node
    53     inline const std::string& root_node(void) const {return root_node_.value();}
     52    std::string root(void) const;
    5453    /// @return absolute path to target directory
    55     inline const std::string& targetdir(void) const
    56     { return targetdir_.value(); }
    57     inline bool verbose(void) const { return verbose_.value(); }
     54    std::string targetdir(void) const;
     55    bool verbose(void) const;
    5856
    5957  private:
    6058    void analyse(void);
    61     void help(void) const;
    62     void missing_argument(std::string opt) const;
    63     void version(bool=false) const;
     59    // throw cmd_error if path doesn't exist
     60    void check_existence(std::string path) const;
     61    // throw cmd_error if path is not dir
     62    void check_is_dir(std::string path) const;
     63    // throw cmd_error if path is not readable
     64    void check_readable(std::string path) const;
    6465
    65     Option<std::string> config_file_;
    66     Option<bool> copyright_;
    67     Option<bool> force_;
    68     Option<bool> generate_config_;
    69     Option<bool> ignore_cache_;
    70     Option<bool> report_;
    71     Option<bool> revisions_;
    72     Option<std::string> root_;
    73     Option<std::string> root_node_;
    74     Option<std::string> targetdir_;
    75     Option<bool> verbose_;
     66    void init(void);
     67
     68    CommandLine cmd_;
     69    OptionArg<std::string>* config_file_;
     70    OptionSwitch* copyright_;
     71    OptionSwitch* force_;
     72    OptionSwitch* generate_config_;
     73    OptionHelp* help_;
     74    OptionSwitch* ignore_cache_;
     75    OptionSwitch* report_;
     76    OptionSwitch* revisions_;
     77    OptionArg<std::string>* root_;
     78    OptionArg<std::string>* target_;
     79    OptionSwitch* verbose_;
     80    OptionVersion* version_;
     81
    7682  };
    7783
  • branches/replacing_gnuplot/bin/svndigest.cc

    r646 r784  
    33/*
    44  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2008 Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     5  Copyright (C) 2008, 2009 Peter Johansson
     6
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    88
    99  svndigest is free software; you can redistribute it and/or modify it
    1010  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1212  (at your option) any later version.
    1313
     
    1818
    1919  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2321*/
    2422
     
    2826#include "css.h"
    2927#include "Directory.h"
     28#include "Exception.h"
    3029#include "first_page.h"
    3130#include "GnuplotFE.h"
     
    6160      std::cout << "Done parsing parameters" << std::endl;
    6261  }
    63   catch (std::runtime_error e) {
     62  catch (cmd_error& e) {
    6463    std::cerr << e.what() << std::endl;
    6564    exit(-1);
     
    106105
    107106  // check if target already exists and behave appropriately
    108   if (option->verbose())
    109     std::cout << "Checking target directory" << std::endl;
     107  bool need_to_erase_target=false;
    110108  std::string target_path=option->targetdir() + '/' + file_name(option->root());
    111   bool need_to_erase_target = node_exist(target_path);
    112   if (need_to_erase_target && !option->force()) {
    113     std::cerr << "svndigest: directory `"
    114               << target_path << "' already exists\n";
    115     exit(-1);
     109  if (option->report()) {
     110    if (option->verbose())
     111      std::cout << "Checking target directory" << std::endl;
     112    need_to_erase_target = node_exist(target_path);
     113    if (need_to_erase_target && !option->force()) {
     114      std::cerr << "svndigest: directory `"
     115                << target_path << "' already exists\n";
     116      exit(-1);
     117    }
    116118  }
    117119
     
    164166      std::vector<std::string> dates;
    165167      dates.reserve(log.commits().size());
    166       for (size_t i=0; i<log.commits().size(); ++i) {
    167         assert(static_cast<svn_revnum_t>(i)==log.commits()[i].revision());
    168         dates.push_back(log.commits()[i].date());
     168      for (SVNlog::container::const_iterator iter=log.commits().begin();
     169           iter!=log.commits().end(); ++iter) {
     170        assert(static_cast<svn_revnum_t>(dates.size())==iter->revision());
     171        dates.push_back(iter->date());
    169172      }
    170       GnuplotFE::instance()->set_dates(dates);
    171     }
    172     chdir(option->targetdir().c_str());
     173      GnuplotFE::instance()->set_dates(dates);
     174    }
     175    if (chdir(option->targetdir().c_str()) ) {
     176      std::cerr << "svndigest: chdir " << option->targetdir() << " failed\n";
     177      exit(-1);
     178    }
    173179    mkdir(tree->name());
    174     chdir(tree->name().c_str());
     180    if (chdir(tree->name().c_str()) ) {
     181      std::cerr << "svndigest: chdir " << tree->name() << " failed\n";
     182      exit(-1);
     183    }
    175184    GnuplotFE::instance()->command(std::string("cd '")+option->targetdir()+"/"
    176185                                   +tree->name()+"'");
  • branches/replacing_gnuplot/bootstrap

    r590 r784  
    88
    99# Copyright (C) 2005, 2006 Jari Häkkinen
    10 # Copyright (C) 2007 Peter Johansson
     10# Copyright (C) 2007, 2008 Peter Johansson
    1111#
    12 # This file is part of svndigest, http://trac.thep.lu.se/svndigest
     12# This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1313#
    1414# svndigest is free software; you can redistribute it and/or modify it
    1515# under the terms of the GNU General Public License as published by
    16 # the Free Software Foundation; either version 2 of the License, or
     16# the Free Software Foundation; either version 3 of the License, or
    1717# (at your option) any later version.
    1818#
     
    2323#
    2424# You should have received a copy of the GNU General Public License
    25 # along with this program; if not, write to the Free Software
    26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    27 # 02111-1307, USA.
     25# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2826
    2927# Run this to generate all auto-generated files needed by the GNU
  • branches/replacing_gnuplot/configure.ac

    r646 r784  
    1313# Copyright (C) 2006 Jari Häkkinen
    1414# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     15# Copyright (C) 2009 Peter Johansson
    1516#
    16 # This file is part of svndigest, http://trac.thep.lu.se/svndigest
     17# This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1718#
    1819# svndigest is free software; you can redistribute it and/or modify it
    1920# under the terms of the GNU General Public License as published by
    20 # the Free Software Foundation; either version 2 of the License, or
     21# the Free Software Foundation; either version 3 of the License, or
    2122# (at your option) any later version.
    2223#
     
    2728#
    2829# You should have received a copy of the GNU General Public License
    29 # along with this program; if not, write to the Free Software
    30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    31 # 02111-1307, USA.
    32 
    33 AC_PREREQ(2.60)
    34 
    35 
    36 m4_include([./build_support/version.m4])
     30# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
     31
     32AC_PREREQ(2.61)
     33
     34m4_include([m4/version.m4])
    3735AC_INIT([svndigest],[SVNDIGEST_VERSION],[jari@thep.lu.se])
    3836AC_CONFIG_SRCDIR([lib/File.h])
    3937AC_CONFIG_AUX_DIR([autotools])
     38dnl arg below should be the same as in Makefile.am
     39AC_CONFIG_MACRO_DIR([m4])
    4040AC_PREFIX_DEFAULT([/usr/local])
    41 test $prefix = NONE && prefix=/usr/local
    4241
    4342AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION])
     
    4645
    4746AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD],
    48           [true if dev build (version starts with pre)])
    49 AC_DEFINE([VERSION_MAJOR], [SVNDIGEST_MAJOR_VERSION],
     47          [true if dev build (version ends with pre)])
     48AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION],
    5049                    [Define to the svndigest major version])
    51 AC_DEFINE([VERSION_MINOR], [SVNDIGEST_MINOR_VERSION],
     50AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION],
    5251                    [Define to the svndigest minor version])
    53 AC_DEFINE([VERSION_PATCH], [SVNDIGEST_PATCH_VERSION],
     52AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION],
    5453                    [Define to the svndigest patch version])
    5554
    5655AC_CONFIG_HEADER([config.h])
    57 AM_INIT_AUTOMAKE([std-options check-news])
    58 
    59 # seems like these variables are not set with older autoconf(?)
    60 AC_SUBST([abs_srcdir], ["`cd $srcdir && pwd`"])
    61 AC_SUBST([abs_builddir], ["`pwd`"])
     56AM_INIT_AUTOMAKE([1.10 std-options check-news])
    6257
    6358# Set default programming language
    6459AC_LANG(C++)
     60
     61# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
     62for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
     63  eval isset=\${$var+set}
     64  if test "$isset" = 'set' ; then
     65    eval val=$`echo $var`
     66    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
     67  fi
     68done
     69AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
    6570
    6671# Let user overide default CXXFLAGS
     
    6873  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
    6974fi
     75
    7076# Checks for programs.
    7177AC_PROG_CXXCPP
    7278AC_PROG_CXX
    7379AC_PROG_INSTALL
    74 AC_PROG_LIBTOOL
     80AC_PROG_RANLIB
    7581AC_PROG_SED
    76 AC_CHECK_PROG([GNUPLOT],[gnuplot],[ok])
     82AC_PATH_PROG([HELP2MAN], [help2man], [no])
     83AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno])
     84AC_PATH_PROG([GNUPLOT],[gnuplot],[no])
     85AC_DEFINE_UNQUOTED([GNUPLOT_PATH], ["$GNUPLOT"],
     86                   [defined to gnuplot path (or no if gnuplot was not found)])
    7787
    7888# Save FLAGS
     
    8595# using extension beyond the C++ standard (usage of non C++ standard
    8696# 'long long' types).
    87 SD_CXXFLAGS="$SD_CXXFLAGS-Wall -pedantic -Wno-long-long"
    88 AC_TYPE_LONG_LONG_INT()
    89 
    90 AC_ARG_ENABLE(debug,
     97YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-pedantic -Wno-long-long])
     98AC_TYPE_LONG_LONG_INT
     99AS_IF([test x$ac_cv_type_long_long_int = xno],
     100      [AC_MSG_ERROR([compiler does not support long long int])]
     101     )
     102
     103AC_ARG_ENABLE([debug],
    91104  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])],
    92   [SD_CXXFLAGS="$SD_CXXFLAGS -g -O"],
    93   [SD_CPPFLAGS="-DNDEBUG" SD_CXXFLAGS="$SD_CXXFLAGS -O3"])
    94 
    95 # optionally prepare for building static libraries.
    96 AC_ARG_ENABLE(staticbin,
    97   [AS_HELP_STRING([--enable-staticbin], [create a static binary,
    98   at least as static as the available underlying libraries
    99   allows])])
    100 if test "$enable_staticbin" = "yes"; then
    101   case $host in
    102   *-apple-darwin*)
    103     # At the time of creating this libsvn_subr uses
    104     # Keychain on Mac OSX. In consequence the below
    105     # frameworks are needed for succesful static builds.
    106     SD_LIBS="$SD_LIBS -framework Security"
    107     SD_LIBS="$SD_LIBS -framework CoreFoundation"
    108     SD_LIBS="$SD_LIBS -framework CoreServices"
    109     ;;
    110   esac
    111   STATICFLAG=-static
    112   AC_SUBST(STATICFLAG)
    113 fi
     105  [YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-g -O])],
     106  [YAT_CPP_ADD_FLAG([SD_CPPFLAGS],[-DNDEBUG])
     107   YAT_CXX_ADD_FLAG([SD_CXXFLAGS],[-O3])])
     108
     109# enable svn-support
     110AC_ARG_ENABLE([svn-support],
     111              [AS_HELP_STRING([--enable-svn-support],
     112                              [enable svn support - used by maintainer])])
     113
     114AS_IF([test "x$enable_svn-support" = xyes],
     115      [AC_CHECK_FILE([$srcdir/.svn],,
     116                     [AC_MSG_ERROR([svn support cannot be enabled: `$srcdir' is not an svn wc.])])])
     117AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn-support" = "xyes"])
    114118
    115119# Apache Portable Runtime (APR) API checks
    116 # The next three lines are not needed as long as APR_FIND_APR is used.
    117 # AC_ARG_WITH(apr,
    118 #  [  --with-apr=DIR          prefix for installed APR or path to APR build
    119 #                          tree [[PREFIX]]])
    120 # Include APR_FIND_APR macro distributed within the APR project. If
    121 # the usage of the APR macro is to be omitted then the construct for
    122 # setting the CXXFLAGS (header file location) and LDFLAGS (linking
    123 # informaion) for APR must be changed. The latter can be achieved with
    124 # AC_SEARCH_LIBS([apr_allocator_create],[apr-0],,apr_found="no") but
    125 # apr-0 must be prior knowledge.
    126 m4_sinclude(./build_support/find_apr.m4)
    127120APR_FIND_APR(,,1,[1 0])
     121AS_IF([test "${with_apr+set}" = set],
     122    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
     123)
    128124if test "$apr_found" = "yes" ; then
    129     SD_LDFLAGS="`$apr_config --link-ld` $SD_LDFLAGS"
    130     SD_CPPFLAGS="`$apr_config --includes --cppflags` $SD_CPPFLAGS"
     125    SD_LIBS="`$apr_config --libs` $SD_LIBS"
     126    apr_link_ld=`$apr_config --link-ld`
     127    for i in $apr_link_ld; do
     128      AS_IF([test ${i:0:2} = "-l"],[SD_LIBS="$i $SD_LIBS"],
     129            [YAT_LD_ADD_FLAG([SD_LDFLAGS], [$i])])
     130    done
     131    YAT_CPP_ADD_FLAG([SD_CPPFLAGS],[`$apr_config --includes --cppflags`])
    131132fi
    132133
     
    135136AC_ARG_WITH(svn,
    136137  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
    137   [ SD_LDFLAGS="-L$withval/lib $SD_LDFLAGS"
    138     SD_CPPFLAGS="-I$withval/include $SD_CPPFLAGS"])
     138  [ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval"
     139    YAT_LD_ADD_FLAG([SD_LDFLAGS], [-L$withval/lib])
     140    YAT_CPP_ADD_FLAG([SD_CPPFLAGS], [-L$withval/include])
     141  ])
     142
    139143
    140144
     
    147151AC_CHECK_HEADER([apr_allocator.h],,apr_found="no")
    148152AC_CHECK_HEADER([subversion-1/svn_types.h],,svn_found="no")
    149 # The library checks below may match shared libs even when
    150 # --enable-staticbin is given to configure. This should probably not
    151 # pose any problems since in a properly installed system the shared
    152 # and static libraries should be the same.
    153153AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
    154154               [SD_LIBS="-lsvn_subr-1 $SD_LIBS"],svn_found="no")
     
    175175
    176176# check if svnversion is installed
    177 have_svnversion="yes"
    178 AC_PATH_PROG(SVNVERSION, svnversion, have_svnversion="no")
     177AC_PATH_PROG([SVNVERSION], [svnversion], [no])
    179178
    180179# checking if we build in a subversion WC
    181 wc_found="no";
    182 if (test $have_svnversion != "no" &&
    183     test `$SVNVERSION -n $srcdir` != "exported");
    184 then
    185    wc_found="yes";
    186 fi
    187 AC_CHECK_FILE("$srcdir/lib/subversion_info.cc",info_found="yes",info_found="no")
    188 
    189 # checking that DEV_BUILD is set to false at time of release
    190 # Failure should be captured by distcheck
    191 if (test "$wc_found" = "no" && test "$SVNDIGEST_DEV_BUILD" = "true") ; then
    192   AC_MSG_ERROR([Incorrect version:
    193                [SVNDIGEST_DEV_BUILD] is set to SVNDIGEST_DEV_BUILD.
    194          [SVNDIGEST_DEV_BUILD] should be set to false at time of release.
    195                Please, update version.m4.])
    196 fi
    197 
    198 
    199 # devel version should have svn WC and SVNVERSION installed
    200 AM_CONDITIONAL(HAVE_SVN_WC, test "$wc_found" = "yes" )
     180AC_CHECK_FILE([$srcdir/.svn], [wc_found="yes"], [wc_found="no"])
     181AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
     182AC_SUBST([wc_found])
     183
     184# checking if we have test repo
     185test_repo_filename=$srcdir/test/repo;
     186AC_CHECK_FILE([$test_repo_filename],
     187              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
     188               test_repo_found="yes"],
     189              [test_repo_found="no"])
     190AC_SUBST([test_repo_found])
     191AS_IF([test "x$test_repo_found" = xyes],
     192      [abs_test_repo=`cd $test_repo_filename && pwd`;
     193       AC_SUBST(abs_test_repo)]
     194     )
     195AC_CONFIG_FILES([test/test_repo.sh], [chmod +x test/test_repo.sh])
     196AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
     197AC_CONFIG_FILES([test/check_repo_status.sh],
     198                [chmod +x test/check_repo_status.sh])   
    201199
    202200
     
    204202                bin/Makefile
    205203                lib/Makefile
     204                man/Makefile
    206205                test/environment.h
    207206                test/Makefile])
     
    214213all_reqs_ok="true"
    215214
    216 if (test "$wc_found" != "yes") ; then
    217 if (test "$info_found" = "no") ; then
    218    AC_MSG_WARN([Cannot find sources (lib/subversion_info.cc).])
    219    if (test "$svnversion" = "no") ; then
    220      AC_MSG_WARN([If you grabbed the source from the subversion repository,
    221      the file will be generated automatically. However, svnversion cannot
    222      be found and therefore the file cannot be generated. Please install
    223      svnversion and make sure it is in your search path.])
    224    else
    225      AC_MSG_WARN([If you grabbed the source from the subversion repository,
    226      the file will be generated automatically. However, the output from
    227      svnversion was incorrect. Either your installation of svnversion is
    228      is not healthy or there is something wrong with the repository.])
    229    fi
    230    all_reqs_ok="false"
    231 else
    232    dnl test repo is not distributed
    233    AC_CONFIG_FILES([test/test_repo.sh
    234                     test/check_repo_status.sh],
    235                    [chmod +x test/test_repo.sh;
    236                     chmod +x test/check_repo_status.sh])
    237    
    238 fi
     215if (test "$wc_found" = "yes"); then
     216   if test x$HELP2MAN = xno; then
     217     AC_MSG_WARN(m4_text_wrap(m4_normalize([
     218       `help2man' is missing on your system.  You will not be
     219       able to create the man page. A sound man page should be
     220       included in a distribution, and since you will not able
     221       to create a complete distribution `make dist' will fail.
     222       ]),[                   ],
     223          [                             ], 79))
     224   fi
     225   # svnversion is required when building from svn wc
     226   if (test "$svnversion" = "no"); then
     227      all_reqs_ok="false";
     228      AC_MSG_WARN([dnl
     229Cannot find svnversion, which is required when building from a
     230subversion working copy. Please install svnversion and make sure it is
     231in your search path.]);
     232   fi
     233   if (test "$test_repo_found" = "no"); then
     234      all_reqs_ok="false";
     235      AC_MSG_WARN([dnl
     236Cannot find test repository (test_repo_filename), which should be
     237available when building from a subversion working copy. Try svn
     238update in top directory.]);
     239   fi
    239240fi
    240241
    241242# Non-existing APR is fatal -- sub-sequent compilation will fail.
    242243if (test "$apr_found" = "no") ; then
    243     AC_MSG_WARN([APR not found. The Apache Portable Runtime
    244     (APR) library cannot be found. Please make sure APR is installed
    245     and supply the appropriate --with-apr option to 'configure'.])
    246     all_reqs_ok="false"
     244  AC_MSG_WARN([APR not found. The Apache Portable Runtime
     245  (APR) library cannot be found. Please make sure APR is installed
     246  and supply the appropriate --with-apr option to 'configure'.])
     247  all_reqs_ok="false"
    247248fi
    248249
    249250# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
    250251if (test "$svn_found" = "no") ; then
    251     svn_msg="Subversion API not found. Subversion API libraries cannot
    252     be found. Make sure the APIs are installed and supply the
    253     appropriate --with-svn option to 'configure'."
    254 if (test "$apr_found" = "no") ; then
     252  svn_msg="Subversion API not found. Subversion API libraries cannot
     253  be found. Make sure the APIs are installed and supply the
     254  appropriate --with-svn option to 'configure'."
     255  if (test "$apr_found" = "no") ; then
    255256    svn_msg="$svn_msg
    256257    Note, APR was not found. Failure to locate APR affects the search
    257258    of the subversion API. Please fix the APR problem before trying
    258259    to resolve the subversion related issues."
    259 fi
    260     AC_MSG_WARN([$svn_msg])
    261     all_reqs_ok="false"
     260  fi
     261  AC_MSG_WARN([$svn_msg])
     262  all_reqs_ok="false"
    262263fi
    263264
    264265if test $ac_cv_type_long_long_int != yes ; then
    265    AC_MSG_WARN([Compiler $CXX does not support `long long'.
    266           svndigest must be compiled with a compiler that supports `long long'.])
    267    all_reqs_ok="false"
     266  AC_MSG_WARN([Compiler $CXX does not support `long long'.
     267  svndigest must be compiled with a compiler that supports `long long'.])
     268  all_reqs_ok="false"
    268269fi
    269270
    270271if (test "$all_reqs_ok" = "false") ; then
    271     AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
    272     configure. Please consult the 'README' file for more information
    273     about what is needed to compile svndigest and refer to above
    274     warning messages. Needed files were NOT created.])
     272  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
     273  configure. Please consult the 'README' file for more information
     274  about what is needed to compile svndigest and refer to above
     275  warning messages. Needed files were NOT created.])
    275276fi
    276277
     
    292293
    293294# Failure to locate gnuplot is not considered fatal
    294 if (test "$GNUPLOT" != "ok") ; then
    295     AC_MSG_WARN([Gnuplot was not found. svndigest will compile
    296     without gnuplot but will throw an exception at run-time. Please
    297     install gnuplot (available for a wide range of operating systems
    298     at http://www.gnuplot.info).])
    299     AC_MSG_NOTICE([])
    300 fi
    301 
    302 if test "$enable_staticbin" = "yes"; then
    303     AC_MSG_NOTICE([A statically linked 'svndigest' binary will be created.])
    304 else
    305     AC_MSG_NOTICE([A dynamically linked 'svndigest' binary will be created.])
    306 fi
    307     AC_MSG_NOTICE([])
    308 
    309 AC_MSG_NOTICE([Now type 'make ; make check'.])
    310 
     295if (test "x$GNUPLOT" = "xno") ; then
     296  AC_MSG_WARN([Gnuplot was not found. svndigest will compile
     297  without gnuplot but will throw an exception at run-time. Please
     298  install gnuplot (available for a wide range of operating systems
     299  at http://www.gnuplot.info).])
     300  AC_MSG_NOTICE([])
     301fi
     302
     303AC_MSG_NOTICE([Now type 'make && make check'.])
  • branches/replacing_gnuplot/doc/readme.txt

    r526 r784  
    2323still are in use.
    2424
    25 see also: http://trac.thep.lu.se/svndigest/wiki/StatsType
     25see also: http://dev.thep.lu.se/svndigest/wiki/StatsType
    2626
    2727== Different linetypes ==
     
    5858For a more detailed illustration, please have a look at `config` that
    5959can be found in directory `.svndigest`, and the svndigest screenshots
    60 that can be reached through http://trac.thep.lu.se/svndigest/.
     60that can be reached through http://dev.thep.lu.se/svndigest/.
    6161
    6262Sometimes it might be useful if a file could be parsed as though it
     
    8181and symbolic links as zero-line files. There is a possibility to
    8282exclude files from the statistics, the use of the property
    83 svndigest:ignore.
     83svndigest:ignore. 
    8484
    8585Sometimes large test files and XML files are added to the repository
     
    8989directory will exclude all siblings to that directory from svndigest
    9090treatment.
     91
     92To set the property on file `FILE`, issue `svn propset
     93svndigest:ignore "" FILE`. For more detailed information refer to
     94http://svnbook.red-bean.com/.
    9195
    9296== Configuration ==
     
    164168Copyright (C) 2005 Jari Häkkinen
    165169Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    166 Copyright (C) 2007 Peter Johansson
     170Copyright (C) 2007, 2008 Peter Johansson
    167171
    168 This file is part of svndigest, http://trac.thep.lu.se/svndigest
     172This file is part of svndigest, http://dev.thep.lu.se/svndigest
    169173
    170174svndigest is free software; you can redistribute it and/or modify it
    171175under the terms of the GNU General Public License as published by the
    172 Free Software Foundation; either version 2 of the License, or (at your
     176Free Software Foundation; either version 3 of the License, or (at your
    173177option) any later version.
    174178
     
    179183
    180184You should have received a copy of the GNU General Public License
    181 along with this program; if not, write to the Free Software
    182 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    183 USA.
     185along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    184186}}}
    185 
    186 
  • branches/replacing_gnuplot/lib/AddStats.cc

    r646 r784  
    44  Copyright (C) 2008 Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
     
    3129#include <cassert>
    3230#include <cstdlib>
     31#include <functional>
    3332#include <map>
    3433#include <string>
     
    5453
    5554
    56   void AddStats::do_parse(const std::string& path)
     55  void AddStats::do_parse(const std::string& path, svn_revnum_t rev)
    5756  {
    58     LineTypeParser parser(path);
    5957    SVNlog log(path);
    60     typedef std::set<svn_revnum_t> RevSet;
     58    typedef std::set<svn_revnum_t, std::greater<svn_revnum_t> > RevSet;
    6159    RevSet revs;
    6260    std::transform(log.commits().begin(), log.commits().end(),
    63                    std::inserter(revs, revs.begin()), GetRevision());
    64     for (RevSet::iterator rev_iter=revs.begin();rev_iter!=revs.end();++rev_iter){
     61                   std::inserter(revs, revs.begin()),
     62                   std::mem_fun_ref(&Commitment::revision));
     63    for (RevSet::iterator rev_iter=revs.begin();
     64         rev_iter!=revs.end() && *rev_iter>=rev; ++rev_iter){
    6565      SVNblame svn_blame(path, *rev_iter);
     66      LineTypeParser parser(path);
    6667      while (svn_blame.valid()) {
     68        LineTypeParser::line_type lt = parser.parse(svn_blame.line());
    6769        if (*rev_iter==svn_blame.revision())
    68           add(svn_blame.author(), *rev_iter, parser.parse(svn_blame.line()));
     70          add(svn_blame.author(), *rev_iter, lt);
    6971        // I dont trust blame and log behave consistent (stop-on-copy).
    7072        revs.insert(svn_blame.revision());
     
    7274      }
    7375    }
    74    
    75     accumulate_stats();
     76    accumulate_stats(rev);
    7677  }
    7778
  • branches/replacing_gnuplot/lib/AddStats.h

    r543 r784  
    77  Copyright (C) 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
     
    4442
    4543  private:
    46     void do_parse(const std::string&);
     44    void do_parse(const std::string&, svn_revnum_t);
    4745
    4846  };
  • branches/replacing_gnuplot/lib/Alias.cc

    r519 r784  
    22
    33/*
    4   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2007, 2008 Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
  • branches/replacing_gnuplot/lib/Alias.h

    r519 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/BlameStats.cc

    r646 r784  
    55  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    66
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    88
    99  svndigest is free software; you can redistribute it and/or modify it
    1010  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1212  (at your option) any later version.
    1313
     
    1818
    1919  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2321*/
    2422
     
    2624
    2725#include "Functor.h"
    28 #include "GnuplotFE.h"
    2926#include "SVNblame.h"
    3027#include "SVNinfo.h"
     
    3633#include <cstdlib>
    3734#include <fstream>
     35#include <functional>
    3836#include <iostream>
    3937#include <iterator>
     
    7674
    7775
    78   void BlameStats::do_parse(const std::string& path)
     76  void BlameStats::do_parse(const std::string& path, svn_revnum_t first_rev)
    7977  {
    80     LineTypeParser parser(path);
    8178    SVNlog log(path);
    8279    typedef std::set<svn_revnum_t> RevSet;
    8380    RevSet revs;
    8481    std::transform(log.commits().begin(), log.commits().end(),
    85                    std::inserter(revs, revs.begin()), GetRevision());
    86     for (RevSet::iterator rev_iter=revs.begin();rev_iter!=revs.end();++rev_iter){
     82                   std::inserter(revs, revs.begin()),
     83                   std::mem_fun_ref(&Commitment::revision));
     84    for (RevSet::reverse_iterator rev_iter=revs.rbegin();
     85         rev_iter!=revs.rend() && *rev_iter>=first_rev; ++rev_iter){
    8786      SVNblame svn_blame(path, *rev_iter);
     87      LineTypeParser parser(path);
    8888      while (svn_blame.valid()) {
    8989        add(svn_blame.author(), *rev_iter, parser.parse(svn_blame.line()));
     
    9696    // filling in pristine revisions
    9797    RevSet::iterator rev_iter=revs.begin();
    98     for (svn_revnum_t rev = 1; rev<=revision(); ++rev){
     98    for (svn_revnum_t rev = first_rev+1; rev<=revision(); ++rev){
    9999      if (rev==*rev_iter)
    100100        ++rev_iter;
  • branches/replacing_gnuplot/lib/BlameStats.h

    r537 r784  
    99  Copyright (C) 2007 Peter Johansson
    1010
    11   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1212
    1313  svndigest is free software; you can redistribute it and/or modify it
    1414  under the terms of the GNU General Public License as published by
    15   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1616  (at your option) any later version.
    1717
     
    2222
    2323  You should have received a copy of the GNU General Public License
    24   along with this program; if not, write to the Free Software
    25   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    26   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2725*/
    2826
     
    4644
    4745  private:
    48     void do_parse(const std::string&);
     46    void do_parse(const std::string&, svn_revnum_t);
    4947    void fill_in(Author2Vector&, svn_revnum_t rev);
    5048
  • branches/replacing_gnuplot/lib/ClassicStats.cc

    r552 r784  
    55  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    66
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    88
    99  svndigest is free software; you can redistribute it and/or modify it
    1010  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1212  (at your option) any later version.
    1313
     
    1818
    1919  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2321*/
    2422
     
    2624
    2725#include "Functor.h"
    28 #include "GnuplotFE.h"
    2926#include "SVNblame.h"
    3027#include "SVNinfo.h"
     
    6259
    6360
    64   void ClassicStats::do_parse(const std::string& path)
     61  void ClassicStats::do_parse(const std::string& path, svn_revnum_t rev)
    6562  {
    6663    LineTypeParser parser(path);
    6764    SVNblame svn_blame(path);
    6865    while (svn_blame.valid()) {
    69       add(svn_blame.author(), svn_blame.revision(),
    70           parser.parse(svn_blame.line()));
     66      if (svn_blame.revision()>=rev) {
     67        add(svn_blame.author(), svn_blame.revision(),
     68            parser.parse(svn_blame.line()));
     69      }
    7170      svn_blame.next_line();
    7271    }
    73     accumulate_stats();
    74 
     72    accumulate_stats(rev);
    7573  }
    7674
  • branches/replacing_gnuplot/lib/ClassicStats.h

    r531 r784  
    99  Copyright (C) 2007 Peter Johansson
    1010
    11   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1212
    1313  svndigest is free software; you can redistribute it and/or modify it
    1414  under the terms of the GNU General Public License as published by
    15   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1616  (at your option) any later version.
    1717
     
    2222
    2323  You should have received a copy of the GNU General Public License
    24   along with this program; if not, write to the Free Software
    25   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    26   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2725*/
    2826
     
    4644
    4745  private:
    48     void do_parse(const std::string&);
     46    void do_parse(const std::string&, svn_revnum_t);
    4947
    5048  };
  • branches/replacing_gnuplot/lib/ColumnStream.cc

    r519 r784  
    22
    33/*
    4   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2007, 2008 Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
  • branches/replacing_gnuplot/lib/ColumnStream.h

    r646 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88  Copyright (C) 2008 Jari Häkkinen
    99
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1111
    1212  svndigest is free software; you can redistribute it and/or modify it
    1313  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1515  (at your option) any later version.
    1616
     
    2121
    2222  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2624*/
    2725
  • branches/replacing_gnuplot/lib/Commitment.cc

    r646 r784  
    22
    33/*
    4   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2007, 2008 Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
  • branches/replacing_gnuplot/lib/Commitment.h

    r646 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
     
    9391  };
    9492
    95   struct GetAuthor
     93  struct LessRevision
    9694  {
    97     inline const std::string& operator()(const Commitment& commit) const
    98     { return commit.author(); }
    99   };
    100 
    101   struct GetRevision
    102   {
    103     inline svn_revnum_t operator()(const Commitment& commit) const
    104     { return commit.revision(); }
     95    inline bool operator()(const Commitment& lhs, const Commitment& rhs)
     96    { return lhs.revision()<rhs.revision(); }
    10597  };
    10698
  • branches/replacing_gnuplot/lib/Configuration.cc

    r556 r784  
    22
    33/*
    4   Copyright (C) 2007 Peter Johansson
    5 
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     4  Copyright (C) 2007, 2008 Peter Johansson
     5  Copyright (C) 2008 Jari Häkkinen
     6
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
     
    168167      }
    169168      else if (section == "copyright") {
    170         if (lhs=="missing-copyright-warning")
     169        if (lhs=="missing-copyright-warning") {
    171170          if (equal_false(rhs))
    172171            missing_copyright_warning_ = false;
     
    176175            throw Config_error(line, "");
    177176          }
     177        }
    178178      }
    179179      else if (section == "parsing-codons") {
     
    353353    add_codon("*.ac", "dnl", "\n");
    354354    add_codon("*.am", "#", "\n");
    355     add_codon("*.am", "dnl", "\n");
    356355    add_codon("*.m4", "#", "\n");
    357356    add_codon("*.m4", "dnl", "\n");
     
    459458       << "# If trac-root is set, svndigest will create anchors to "
    460459       << "the Trac page.\n"
    461        << "# trac-root = http://trac.thep.lu.se/svndigest/\n";
     460       << "# trac-root = http://dev.thep.lu.se/svndigest/\n";
    462461    if (!conf.trac_root().empty())
    463462      os << "trac-root = " << conf.trac_root() << "\n";
     
    466465      os << "\n"
    467466         << "### Section for setting dictionary for file names.\n"
    468          << "### Prior looking for file name pattern in section [codon],\n"
     467         << "### Prior looking for file name pattern in section "
     468         << "[parsing-codons],\n"
    469469         << "### the file name may be translated according to the rules \n"
    470470         << "### in this section. In default setting there is, for example,\n"
  • branches/replacing_gnuplot/lib/Configuration.h

    r556 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
     
    7169    ///
    7270    /// @return root for the trac envrionment, e.g.,
    73     /// http://trac.thep.lu.se/svndigest/
     71    /// http://dev.thep.lu.se/svndigest/
    7472    ///
    7573    std::string trac_root(void) const;
  • branches/replacing_gnuplot/lib/Date.cc

    r589 r784  
    33/*
    44  Copyright (C) 2007 Peter Johansson
     5  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2009 Peter Johansson
    57
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    79
    810  svndigest is free software; you can redistribute it and/or modify it
    911  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1113  (at your option) any later version.
    1214
     
    1719
    1820  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2222*/
    2323
     
    2525
    2626#include <algorithm>
     27#include <cassert>
     28#include <ctime>
    2729#include <sstream>
     30#include <stdexcept>
    2831#include <string>
    2932
    3033namespace theplu {
    3134namespace svndigest {
    32 
    33   static const char* wdays_[7] = {
    34     "Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
    35     "Saturday"
    36   };
    37 
    38    
    39   static const char* month_[12] = {
    40     "January", "February", "March", "April", "May", "June", "July", "August",
    41     "September", "October", "November", "December"
    42   };
    43 
    4435
    4536  Date::Date(void)
     
    153144    std::stringstream ss;
    154145    struct tm* timeinfo = std::gmtime(&time_);
    155     for (std::string::iterator i=format.begin(); i!=format.end(); ++i) {
    156       if (*i == '%' && ++i !=format.end()) {
    157         if (*i == 'a')
    158           ss << std::string(wdays_[timeinfo->tm_wday]).substr(0,3);
    159         else if (*i == 'A')
    160           ss << wdays_[timeinfo->tm_wday];
    161         else if (*i == 'b')
    162           ss << std::string(month_[timeinfo->tm_mon]).substr(0,3);
    163         else if (*i == 'B')
    164           ss << month_[timeinfo->tm_mon];
    165         else if (*i == 'd')
    166           ss << timeinfo->tm_mday;
    167         else if (*i == 'e') {
    168           if (timeinfo->tm_mday<10)
    169             ss << "0";
    170           ss << timeinfo->tm_mday;
    171         }
    172         else if (*i == 'H') {
    173           if (timeinfo->tm_hour<10)
    174             ss << "0";
    175           ss << timeinfo->tm_hour;
    176         }
    177         else if (*i == 'I') {
    178           int tmp = (timeinfo->tm_hour + 11) % 12 + 1;
    179           if (tmp<10)
    180             ss << "0";
    181           ss << tmp;
    182         }
    183         else if (*i == 'j')
    184           ss << timeinfo->tm_yday+1;
    185         else if (*i == 'm') {
    186           if (timeinfo->tm_mon<9)
    187             ss << "0";
    188           ss << timeinfo->tm_mon+1;
    189         }
    190         else if (*i == 'M') {
    191           if (timeinfo->tm_min<10)
    192             ss << "0";
    193           ss << timeinfo->tm_min;
    194         }
    195         else if (*i == 'P')
    196           if (timeinfo->tm_hour<12)
    197             ss << "AM";
    198           else
    199             ss << "PM";
    200         else if (*i == 'S') {
    201           if (timeinfo->tm_sec<10)
    202             ss << "0";
    203           ss << timeinfo->tm_sec;
    204         }
    205         else if (*i == 'w')
    206           if (timeinfo->tm_wday==0)
    207             ss << "7";
    208           else
    209             ss << timeinfo->tm_wday;
    210         else if (*i == 'y') {
    211           int y(timeinfo->tm_year % 100);
    212           if (y<10)
    213             ss << "0";
    214           ss << y;
    215         }
    216         else if (*i == 'Y')
    217           ss << timeinfo->tm_year+1900;
    218         else if (*i == 'Z')
    219           ss << timeinfo->tm_zone;
    220         else {
    221           ss << '%';
    222           --i;
    223         }
    224       }
    225       else
    226         ss << *i;
     146    char buffer[80];
     147    size_t res = std::strftime(buffer, 80, format.c_str(), timeinfo);
     148    if (!res) {
     149      throw std::runtime_error("svndigest::Date::operator() failed");
    227150    }
    228 
    229     return ss.str();
     151    return buffer;
    230152  }
    231153
  • branches/replacing_gnuplot/lib/Date.h

    r519 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/Directory.cc

    r589 r784  
    33/*
    44  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    5 
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     5  Copyright (C) 2009 Peter Johansson
     6
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
     
    8988        }
    9089      }
    91     daughters_.sort(NodePtrLess());
     90    std::sort(daughters_.begin(), daughters_.end(), NodePtrLess());
    9291  }
    9392
     
    110109
    111110
    112   SVNlog Directory::log_core(void) const
    113   {
    114     SVNlog log(path());
     111  void Directory::log_core(SVNlog& log) const
     112  {
    115113    for (NodeConstIterator i(daughters_.begin()); i != daughters_.end(); ++i)
    116114      log += (*i)->log();
    117     return log;
    118115  }
    119116
     
    142139  void Directory::print_core(const bool verbose) const
    143140  {
     141    mkdir("blame_output/" + local_path_);
    144142    // print daughter nodes, i.e., this function is recursive
    145143    for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i)
     
    255253
    256254  void Directory::print_copyright(std::map<std::string, Alias>& alias,
    257                                   bool verbose) const {
     255                                  bool verbose,
     256                                  const std::map<int,svn_revnum_t>& y2r) const {
    258257    if (!ignore()){
    259258      // print daughter nodes, i.e, this function is recursive
    260259      for (NodeConstIterator i = daughters_.begin(); i!=daughters_.end(); ++i)
    261         (*i)->print_copyright(alias, verbose);
     260        (*i)->print_copyright(alias, verbose, y2r);
    262261    }
    263262  }
  • branches/replacing_gnuplot/lib/Directory.h

    r589 r784  
    66/*
    77  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2009 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
    2726#include "Node.h"
    2827
    29 #include <list>
    3028#include <map>
    3129#include <string>
     30#include <vector>
    3231
    3332namespace theplu{
     
    8382    const StatsCollection& parse(bool verbose, bool ignore);
    8483
    85     void print_copyright(std::map<std::string, Alias>&, bool verbose) const;
     84    using Node::print_copyright;
     85    /**
     86       virtual function typically called from Node::print_copyright
     87    */
     88    void print_copyright(std::map<std::string, Alias>&, bool verbose,
     89                         const std::map<int, svn_revnum_t>&) const;
    8690
    8791  private:
    8892    /**
    89        @return union of logs from daughter nodes.
     93       add union of logs from daughter nodes.
    9094    */
    91     SVNlog log_core(void) const;
     95    void log_core(SVNlog&) const;
    9296
    9397    ///
     
    102106
    103107
    104     typedef std::list<Node*> NodeContainer;
     108    typedef std::vector<Node*> NodeContainer;
    105109    typedef NodeContainer::iterator NodeIterator;
    106110    typedef NodeContainer::const_iterator NodeConstIterator;
  • branches/replacing_gnuplot/lib/File.cc

    r646 r784  
    33/*
    44  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    5 
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     5  Copyright (C) 2009 Peter Johansson
     6
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
     
    5958
    6059
     60  std::string File::blame_output_file_name(void) const
     61  {
     62    return "blame_output/" + local_path() + ".html";
     63  }
     64
     65
    6166  std::map<int, std::set<Alias> >
    62   File::copyright_map(std::map<std::string, Alias>& alias) const
     67  File::copyright_map(std::map<std::string, Alias>& alias,
     68                      const std::map<int, svn_revnum_t>& year2rev) const
    6369  {
    6470    using namespace std;
    6571    map<int, set<Alias> > year_authors;
    66     SVNlog log(path());
    6772    const Stats& stats = stats_["add"];
    68    
    69     typedef std::vector<Commitment>::iterator LogIterator;
    70     for (LogIterator i=log.commits().begin(); i<log.commits().end(); ++i){
    71       if (i->revision() &&
    72           (stats(LineTypeParser::code, i->author(), i->revision()) >
    73            stats(LineTypeParser::code, i->author(), i->revision()-1) ||
    74            stats(LineTypeParser::comment, i->author(), i->revision()) >
    75            stats(LineTypeParser::comment, i->author(), i->revision()-1))
    76           ) {
     73
     74    // loop over all years
     75    for (std::map<int, svn_revnum_t>::const_iterator rev_iter=year2rev.begin();
     76         rev_iter!=year2rev.end(); ++rev_iter) {
     77
     78      svn_revnum_t last_rev_this_year = rev_iter->second;
     79      svn_revnum_t last_rev_last_year = 0;
     80      if (rev_iter != year2rev.begin()) {
     81        last_rev_last_year = (--rev_iter)->second;
     82        ++rev_iter;
     83      }
     84      // loop over authors
     85      for (std::set<std::string>::const_iterator a_iter=stats.authors().begin();
     86           a_iter!=stats.authors().end(); ++a_iter) {
     87
     88        // check if anything has been added since last year
     89        if ( (stats(LineTypeParser::code, *a_iter, last_rev_this_year) >
     90              stats(LineTypeParser::code, *a_iter, last_rev_last_year)) ||
     91             (stats(LineTypeParser::comment, *a_iter, last_rev_this_year) >
     92              stats(LineTypeParser::comment, *a_iter, last_rev_last_year)) ) {
    7793       
    78         time_t sec = str2time(i->date());
    79         tm* timeinfo = gmtime(&sec);
    8094       
    81         // find username in map of aliases
    82         std::map<string,Alias>::iterator name(alias.lower_bound(i->author()));
    83        
    84         // if alias exist insert alias
    85         if (name != alias.end() && name->first==i->author())
    86           year_authors[timeinfo->tm_year].insert(name->second);
    87         else {
    88           // else insert user name
    89           Alias a(i->author(),alias.size());
    90           year_authors[timeinfo->tm_year].insert(a);
    91           std::cerr << "svndigest: warning: no copyright alias found for `"
    92                     << i->author() << "'\n";
    93           // insert alias to avoid multiple warnings.
    94           alias.insert(name, std::make_pair(i->author(), a));
     95          // find username in map of aliases
     96          std::map<string,Alias>::iterator name(alias.lower_bound(*a_iter));
     97         
     98          // if alias exist insert alias
     99          if (name != alias.end() && name->first==*a_iter)
     100            year_authors[rev_iter->first].insert(name->second);
     101          else {
     102            // else insert user name
     103            Alias a(*a_iter,alias.size());
     104            year_authors[rev_iter->first].insert(a);
     105            std::cerr << "svndigest: warning: no copyright alias found for `"
     106                      << *a_iter << "'\n";
     107            // insert alias to avoid multiple warnings.
     108            alias.insert(name, std::make_pair(*a_iter, a));
     109          }
    95110        }
    96111      }
     
    159174
    160175
    161   SVNlog File::log_core(void) const
    162   {
    163     return SVNlog(path());
     176  void File::log_core(SVNlog&) const
     177  {
    164178  }
    165179
     
    186200    if (!ignore && node_exist(cache_file)){
    187201      std::ifstream is(cache_file.c_str());
    188       if (stats_.load_cache(is)){
     202      if (stats_.load_cache(is)) {
     203        is.close();
    189204        return stats_;
    190205      }
    191206      is.close();
    192207    }
    193     else {
     208    else
    194209      stats_.parse(path_);
    195     }
    196210    if (!node_exist(cache_dir))
    197211      mkdir(cache_dir);
    198     std::ofstream os(cache_file.c_str());
     212    std::string tmp_cache_file(cache_file+"~");
     213    std::ofstream os(tmp_cache_file.c_str());
    199214    stats_.print(os);
    200215    os.close();
     216    rename(tmp_cache_file.c_str(), cache_file.c_str());
    201217    return stats_;
    202218  }
     
    205221  void File::print_blame(std::ofstream& os) const
    206222  {
    207     os << "<br /><h3>Blame Information</h3>";
     223    os << "<br /><h3>" << local_path() << "</h3>";
    208224    os << "<table class=\"blame\">\n";
    209225    os << "<thead>\n";
     
    286302
    287303  void File::print_copyright(std::map<std::string, Alias>& alias,
    288                              bool verbose) const
     304                             bool verbose,
     305                             const std::map<int,svn_revnum_t>& y2rev) const
    289306  {
    290307    if (ignore())
     
    301318      return;
    302319    }
    303     std::map<int, std::set<Alias> > map=copyright_map(alias);
     320    std::map<int, std::set<Alias> > map=copyright_map(alias, y2rev);
    304321    std::string new_block = copyright_block(map, prefix);
    305322    if (old_block==new_block)
     
    313330  void File::print_core(const bool verbose) const
    314331  {
     332    std::ofstream os(blame_output_file_name().c_str());
     333    assert(os.good());
     334    print_html_start(os, "svndigest", level_+1);
     335    print_blame(os);
     336    print_footer(os);
     337    os.close();
    315338  }
    316339
     
    343366    print_author_summary(os, stats_[stats_type], line_type, log);
    344367    os << "\n";
    345 
    346     print_blame(os);
     368    os << "<h3>"
     369       << anchor(blame_output_file_name(),
     370                 "Blame Information", level_+3)
     371       << "</h3>\n";
    347372
    348373    print_footer(os);
  • branches/replacing_gnuplot/lib/File.h

    r589 r784  
    66/*
    77  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2009 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
     
    6665    const StatsCollection& parse(bool verbose, bool ignore);
    6766
     67    using Node::print_copyright;
    6868    /**
    6969       @throw std::runtime_error when a file error is encountered
    7070       updating the copyrights.
    7171    */
    72     void print_copyright(std::map<std::string, Alias>&, bool verbose) const;
     72    void print_copyright(std::map<std::string, Alias>&, bool verbose,
     73                         const std::map<int, svn_revnum_t>&) const;
    7374
    7475  private:
     76    std::string blame_output_file_name(void) const;
     77
    7578    /**
    76        @return log of this File.
     79       do nothing
    7780    */
    78     SVNlog log_core(void) const;
     81    void log_core(SVNlog&) const;
    7982
    8083    ///
     
    100103     */
    101104    std::map<int, std::set<Alias> >
    102     copyright_map(std::map<std::string, Alias>& alias) const;
     105    copyright_map(std::map<std::string, Alias>& alias,
     106                  const std::map<int, svn_revnum_t>&) const;
    103107
    104108    /**
  • branches/replacing_gnuplot/lib/Functor.cc

    r519 r784  
    44  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
  • branches/replacing_gnuplot/lib/Functor.h

    r519 r784  
    66/*
    77  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    8 
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  Copyright (C) 2008 Jari Häkkinen
     9
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
    27 //#include <algorithm>
     26#include <algorithm>
    2827#include <functional>
    29 //#include <iosfwd>
    3028#include <string>
    3129#include <utility>
  • branches/replacing_gnuplot/lib/Gnuplot.cc

    r519 r784  
    44  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2007 Peter Johansson
     6  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    67
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
     23
     24#include <config.h>
    2425
    2526#include "Gnuplot.h"
    2627
    2728#include <cstdio>
     29#include <cstdlib>
    2830#include <string>
    2931#include <unistd.h>
     
    5860  void Gnuplot::acquire_program_path(const std::string& progname)
    5961  {
    60     char* env_path=getenv("PATH");
    61     if (!env_path)
    62       throw GnuplotException("Environment variable PATH is not set");
    63 
    64     std::list<std::string> paths;
    65     tokenizer(env_path,paths);
    66     for (std::list<std::string>::const_iterator i=paths.begin();
    67          i!=paths.end(); ++i) {
    68       std::string tmp((*i) + '/' + progname);
    69       if (!access(tmp.c_str(),X_OK)) {
    70         gnuplot_binary_=tmp;
    71         break;
    72       }
     62    std::string tmp = GNUPLOT_PATH;
     63    if (tmp=="no")
     64      throw GnuplotException("no gnuplot binary available");
     65    if (!access(tmp.c_str(),X_OK)) {
     66      gnuplot_binary_=tmp;
    7367    }
    7468
    7569    if (gnuplot_binary_.empty())
    76       throw GnuplotException("Cannot find '" + progname + "' in PATH");
     70      throw GnuplotException("Cannot find '" + tmp);
    7771  }
    7872
  • branches/replacing_gnuplot/lib/Gnuplot.h

    r519 r784  
    66/*
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2007, 2008 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
  • branches/replacing_gnuplot/lib/GnuplotFE.cc

    r589 r784  
    44  Copyright (C) 2006 Jari Häkkinen
    55  Copyright (C) 2007 Peter Johansson
     6  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    67
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
  • branches/replacing_gnuplot/lib/GnuplotFE.h

    r589 r784  
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    88  Copyright (C) 2007 Peter Johansson
     9  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    910
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1112
    1213  svndigest is free software; you can redistribute it and/or modify it
    1314  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1516  (at your option) any later version.
    1617
     
    2122
    2223  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2625*/
    2726
  • branches/replacing_gnuplot/lib/HtmlBuf.cc

    r606 r784  
    55  Copyright (C) 2008 Peter Johansson
    66
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    88
    99  svndigest is free software; you can redistribute it and/or modify it
    1010  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1212  (at your option) any later version.
    1313
     
    1818
    1919  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2321*/
    2422
  • branches/replacing_gnuplot/lib/HtmlBuf.h

    r606 r784  
    77  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/HtmlStream.cc

    r606 r784  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008 Peter Johansson
    56
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
  • branches/replacing_gnuplot/lib/HtmlStream.h

    r606 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/LineTypeParser.cc

    r556 r784  
    44  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
  • branches/replacing_gnuplot/lib/LineTypeParser.h

    r552 r784  
    88  Copyright (C) 2007 Peter Johansson
    99
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1111
    1212  svndigest is free software; you can redistribute it and/or modify it
    1313  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1515  (at your option) any later version.
    1616
     
    2121
    2222  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2624*/
    2725
  • branches/replacing_gnuplot/lib/Makefile.am

    r646 r784  
    55# Copyright (C) 2005 Jari Häkkinen
    66# Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    7 # Copyright (C) 2007 2008 Peter Johansson
     7# Copyright (C) 2007, 2008 Peter Johansson
     8# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     9# Copyright (C) 2009 Peter Johansson
    810#
    9 # This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11# This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1012#
    1113# svndigest is free software; you can redistribute it and/or modify it
    1214# under the terms of the GNU General Public License as published by
    13 # the Free Software Foundation; either version 2 of the License, or
     15# the Free Software Foundation; either version 3 of the License, or
    1416# (at your option) any later version.
    1517#
     
    2022#
    2123# You should have received a copy of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24 # 02111-1307, USA.
     24# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2525
    2626AM_CPPFLAGS = $(SVNDIGEST_CPPFLAGS)
    2727AM_CXXFLAGS = $(SVNDIGEST_CXXFLAGS)
    2828
    29 noinst_LTLIBRARIES = libsvndigest.la
     29noinst_LIBRARIES = libsvndigest.a
    3030
    3131noinst_HEADERS = AddStats.h Alias.h BlameStats.h ClassicStats.h ColumnStream.h \
    32   Commitment.h Configuration.h css.h\
    33   Date.h Directory.h File.h first_page.h Functor.h Gnuplot.h GnuplotFE.h \
     32  CommandLine.h Commitment.h Configuration.h copyright_year.h css.h\
     33  Date.h Directory.h Exception.h File.h first_page.h Functor.h \
     34  Gnuplot.h GnuplotFE.h \
    3435  HtmlBuf.h HtmlStream.h html_utility.h LineTypeParser.h \
    35   Node.h Option.h rmdirhier.h \
     36  Node.h Option.h OptionArg.h OptionHelp.h OptionSwitch.h \
     37  OptionVersion.h rmdirhier.h \
    3638  Stats.h StatsCollection.h subversion_info.h SVN.h SVNblame.h  \
    3739  SVNinfo.h SVNlog.h SVNproperty.h Trac.h utility.h
    3840
    39 libsvndigest_la_SOURCES = AddStats.cc Alias.cc BlameStats.cc \
     41libsvndigest_a_SOURCES = AddStats.cc Alias.cc BlameStats.cc \
    4042  ClassicStats.cc ColumnStream.cc \
    41   Commitment.cc Configuration.cc \
     43  CommandLine.cc Commitment.cc Configuration.cc copyright_year.cc \
    4244  css.cc Date.cc Directory.cc File.cc first_page.cc\
    4345  Functor.cc Gnuplot.cc GnuplotFE.cc  HtmlBuf.cc HtmlStream.cc \
    4446  html_utility.cc LineTypeParser.cc Node.cc \
    45   rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc        \
     47  Option.cc OptionHelp.cc OptionSwitch.cc OptionVersion.cc \
     48  rmdirhier.cc Stats.cc StatsCollection.cc subversion_info.cc SVN.cc \
    4649  SVNblame.cc SVNinfo.cc SVNlog.cc SVNproperty.cc Trac.cc utility.cc
    4750
     
    5558
    5659if HAVE_SVN_WC
    57 @srcdir@/subversion_info.cc: subversion_info.cc.tmp
    58   @$(SHELL) @top_srcdir@/build_support/move-if-change subversion_info.cc.tmp \
    59   @srcdir@/subversion_info.cc
     60$(srcdir)/subversion_info.cc: subversion_info.cc.tmp
     61  @$(SHELL) $(top_srcdir)/build_support/move-if-change subversion_info.cc.tmp \
     62  $(srcdir)/subversion_info.cc
    6063
    6164subversion_info.cc.tmp: FORCE
    6265  @echo '// subversion_info.cc generated from subversion_info.cc.in.' > $@ ;\
    6366  revision=`$(SVNVERSION) $(top_srcdir)` ;\
    64   year=`svn info $(top_srcdir)|$(SED) -n  's/.*Date: \(.*\)-..-.*/\1/p'`;\
    65   $(SED) -e 's/sub_2_svn_revision/'$$revision'/g' \
    66   -e 's/sub_2_svn_year/'$$year'/g'  @srcdir@/subversion_info.cc.in >> $@ ;
     67  $(SED) -e 's/sub_2_svn_revision/r'$$revision'/g' \
     68  $(srcdir)/subversion_info.cc.in >> $@ ;
     69
     70# update copyright year automatically (if we build from svn wc)
     71$(srcdir)/copyright_year.cc: copyright_year.cc.tmp
     72  @$(SHELL) $(top_srcdir)/build_support/move-if-change $< $@
     73
     74copyright_year.cc.tmp: FORCE
     75  @year=`svn info $(top_srcdir)|$(SED) -n  's/.*Date: \(.*\)-..-.*/\1/p'`;\
     76  $(SED) -e 's/"20[0-9][0-9]"/'\"$$year\"'/g' $(srcdir)/copyright_year.cc > $@ ;
     77
     78else
     79# this is needed in 'svn export' build
     80$(srcdir)/subversion_info.cc:
     81  $(SED) -e 's/sub_2_svn_revision//g' \
     82  $(srcdir)/subversion_info.cc.in >> $@ ;
     83
    6784endif
    6885
  • branches/replacing_gnuplot/lib/Node.cc

    r646 r784  
    33/*
    44  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    5 
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     5  Copyright (C) 2008 Jari Häkkinen
     6  Copyright (C) 2009 Peter Johansson
     7
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    79
    810  svndigest is free software; you can redistribute it and/or modify it
    911  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1113  (at your option) any later version.
    1214
     
    1719
    1820  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2222*/
    2323
     
    2525
    2626#include "Date.h"
     27#include "HtmlStream.h"
    2728#include "html_utility.h"
    2829#include "SVNlog.h"
     
    7778      return svninfo_.last_changed_author();
    7879    assert(log().commits().size());
    79     return log().commits().back().author();
     80    return log().latest_commit().author();
    8081  }
    8182
     
    144145      return svninfo_.last_changed_rev();
    145146    assert(log().commits().size());
    146     return log().commits().back().revision();
     147    return log().latest_commit().revision();
    147148  }
    148149
     
    150151  const SVNlog& Node::log(void) const
    151152  {
    152     if (!log_)
     153    if (!log_) {
    153154      if (ignore())
    154155        log_ = new SVNlog;
    155       else
    156         log_ = new SVNlog(log_core());
     156      else {
     157        log_ = new SVNlog(path());
     158        log_core(*log_);
     159      }
     160    }
    157161    return *log_;
    158162  }
     
    203207    if (verbose)
    204208      std::cout << "Printing output for " << path_ << std::endl;
    205     SVNlog log(path_);
     209    const SVNlog& log = this->log();
    206210    typedef std::map<std::string, Stats*>::const_iterator iter;
    207211
     
    229233                                  const SVNlog& log) const
    230234  {
     235    HtmlStream hs(os);
    231236    os << "<h3>Author Summary</h3>";
    232237    os << "<table class=\"listings\">\n";
     
    252257
    253258    // print authors
    254     const std::string timefmt("%e/%m/%y %H:%M:%S");
     259    const std::string timefmt("%Y-%m-%d  %H:%M");
    255260    for (std::set<std::string>::const_iterator i=stats.authors().begin();
    256261         i!=stats.authors().end(); ++i){
     
    267272         << "</td><td>" << stats.empty(*i);
    268273      if (log.exist(*i)) {
    269         Commitment lc(log.latest_commit(*i));
     274        const Commitment& lc(log.latest_commit(*i));
    270275        os << "</td>" << "<td>" << trac_revision(lc.revision())
    271            << "</td>" << "<td>" << Date(lc.date())(timefmt);
     276           << "</td>" << "<td>";
     277        hs << Date(lc.date())(timefmt);
    272278      }
    273279      else {
     
    295301    os << "<td>" << stats.comments() << "</td>\n";
    296302    os << "<td>" << stats.empty() << "</td>\n";
    297     Commitment lc(log.latest_commit());
     303    const Commitment& lc(log.latest_commit());
    298304    os << "<td>" << trac_revision(lc.revision()) << "</td>\n";
    299     os << "<td>" << Date(lc.date())(timefmt)<< "</td>\n";
     305    os << "<td>";
     306    hs << Date(lc.date())(timefmt);
     307    os << "</td>\n";
    300308    os << "</tr>\n";
    301309    os << "</tbody>\n";
     
    304312
    305313 
     314  void Node::print_copyright(std::map<std::string,Alias>& alias,
     315                             bool verbose) const
     316  {
     317    // map with last rev for every year
     318    std::map<int, svn_revnum_t> year2rev;
     319    SVNlog log(path());
     320    typedef SVNlog::container::const_iterator LogIterator;
     321    for (LogIterator i=log.commits().begin(); i!=log.commits().end(); ++i){
     322      time_t sec = str2time(i->date());
     323      tm* timeinfo = gmtime(&sec);
     324      year2rev[timeinfo->tm_year] = i->revision();
     325    }
     326    print_copyright(alias, verbose, year2rev);
     327  }
     328
     329
    306330  std::string Node::url(void) const
    307331  {
  • branches/replacing_gnuplot/lib/Node.h

    r589 r784  
    66/*
    77  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    8 
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  Copyright (C) 2009 Peter Johansson
     9
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
     
    170169                              const SVNlog&) const;
    171170
    172     virtual void print_copyright(std::map<std::string,Alias>&, bool) const=0;
     171    /**
     172       creates a map from year to last rev for that year and call
     173       virtual function.
     174     */
     175    void print_copyright(std::map<std::string,Alias>&, bool) const;
     176
     177    /**
     178       typically called from function above
     179     */
     180    virtual void print_copyright(std::map<std::string,Alias>&, bool,
     181                                 const std::map<int,svn_revnum_t>&) const=0;
    173182
    174183    /**
     
    190199   
    191200  protected:
    192 
    193     virtual SVNlog log_core(void) const=0;
    194201
    195202    ///
     
    210217    ///
    211218    Node(const Node&);
     219
     220    virtual void log_core(SVNlog&) const=0;
    212221
    213222    virtual void print_core(bool verbose=false) const=0;
  • branches/replacing_gnuplot/lib/Option.h

    r646 r784  
    55
    66/*
     7  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    78  Copyright (C) 2008 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
     26#include <iostream>
    2727#include <string>
     28#include <vector>
    2829
    29 namespace theplu{
    30 namespace svndigest{
     30namespace theplu {
     31namespace svndigest {
    3132
     33  class CommandLine;
    3234  ///
    33   /// Class taking care of cmd options in Parameter
     35  /// @brief Container of variables for an option. @see CommandLine
    3436  ///
    35   template<typename T>
    3637  class Option
    3738  {
    3839  public:
    39     Option(T value): default_(value), value_(value) {}
    40     inline const T& default_value(void) const { return default_; }
    41     inline void reset(void) { value_=default_; }
    42     inline T& value(void) { return value_; }
    43     inline const T& value(void) const { return value_; }
     40    /**
     41       @brief Constructor
     42       
     43       \param cmd Commandline to be hooked up with.
     44       @param name string such as "help" for --help, "h" for -h or
     45       "h,help" for having both short and long option name
     46       @param desc string used in help display
     47    */
     48    Option(CommandLine& cmd, std::string name, std::string desc);
     49
     50    /**
     51       @brief destructor
     52    */
     53    virtual ~Option(void);
     54   
     55    /**
     56       @return description
     57    */
     58    std::string description(void) const;
     59
     60    /**
     61       \return long name e.g. 'help' for --help option.
     62    */
     63    std::string long_name(void) const;
     64
     65    /**
     66       \brief parsing the commandline
     67     */
     68    void parse(std::vector<std::string>::iterator&,
     69               const std::vector<std::string>::iterator&);
     70
     71    /**
     72       @brief Get if option was found in cmd.
     73       
     74       @return true if option has been detected in parsing
     75    */
     76    bool present(void) const;
     77
     78    /**
     79       \brief print help output
     80
     81       This function calls the four virtual private functions print1,
     82       print2, print3, and print4. This allows an inherited class to
     83       implement one (or several) of these functions and keep the
     84       default output of the others. The default behavior is that:
     85
     86       - print1 prints the short name, '-h', as short_name(void) const
     87       - print2 prints the long name, '--help', as long_name(void) const
     88       - print3 is empty
     89       - print4 prints the description as description(void) const.
     90     */
     91    std::string print(void);
     92
     93    /**
     94       \brief sets present to false
     95    */
     96    void reset(void);
     97
     98    /**
     99       \return short name e.g. 'h' for -h option.
     100    */
     101    char short_name(void) const;
     102
     103    /**
     104       \brief Validate the Option
     105
     106       This function is called after commandline is parsed.
     107     */
     108    void validate(void);
     109
     110  protected:
     111    /**
     112       \return const reference to CommandLine Option belongs to.
     113     */
     114    const CommandLine& cmd(void) const;
    44115
    45116  private:
    46     const T default_;
    47     T value_;
     117    virtual void do_parse(std::vector<std::string>::iterator&,
     118                          const std::vector<std::string>::iterator&)=0;
    48119
     120    /**
     121     */
     122    virtual std::string print1(void) const;
     123
     124    /**
     125     */
     126    virtual std::string print2(void) const;
     127
     128    /**
     129     */
     130    virtual std::string print3(void) const;
     131
     132    /**
     133     */
     134    virtual std::string print4(void) const;
     135
     136    /**
     137     */
     138    virtual void do_validate(void) const=0;
     139
     140
     141    const CommandLine& cmd_;
     142    std::string description_;
     143    std::string long_name_;
     144    bool present_;
     145    char short_name_;
     146
     147    // copy not allowed
     148    Option(const Option&);
     149    Option& operator=(const Option&);
    49150  };
    50151
    51 }} // end of namespace svndigest end of namespace theplu
     152}} // of namespace svndigest, and theplu
    52153
    53 #endif 
     154#endif
  • branches/replacing_gnuplot/lib/SVN.cc

    r646 r784  
    66  Copyright (C) 2008 Peter Johansson
    77
    8   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    99
    1010  svndigest is free software; you can redistribute it and/or modify it
    1111  under the terms of the GNU General Public License as published by
    12   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1313  (at your option) any later version.
    1414
     
    1919
    2020  You should have received a copy of the GNU General Public License
    21   along with this program; if not, write to the Free Software
    22   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    23   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2422*/
    2523
  • branches/replacing_gnuplot/lib/SVN.h

    r579 r784  
    99  Copyright (C) 2008 Peter Johansson
    1010
    11   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1212
    1313  svndigest is free software; you can redistribute it and/or modify it
    1414  under the terms of the GNU General Public License as published by
    15   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1616  (at your option) any later version.
    1717
     
    2222
    2323  You should have received a copy of the GNU General Public License
    24   along with this program; if not, write to the Free Software
    25   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    26   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2725*/
    2826
  • branches/replacing_gnuplot/lib/SVNblame.cc

    r535 r784  
    44  Copyright (C) 2006 Jari Häkkinen
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2008 Peter Johansson
    67
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
  • branches/replacing_gnuplot/lib/SVNblame.h

    r535 r784  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2008 Peter Johansson
    910
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1112
    1213  svndigest is free software; you can redistribute it and/or modify it
    1314  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1516  (at your option) any later version.
    1617
     
    2122
    2223  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2625*/
    2726
  • branches/replacing_gnuplot/lib/SVNinfo.cc

    r519 r784  
    44  Copyright (C) 2006 Jari Häkkinen
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2008 Peter Johansson
    67
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
  • branches/replacing_gnuplot/lib/SVNinfo.h

    r519 r784  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2008 Peter Johansson
    910
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1112
    1213  svndigest is free software; you can redistribute it and/or modify it
    1314  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1516  (at your option) any later version.
    1617
     
    2122
    2223  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2625*/
    2726
  • branches/replacing_gnuplot/lib/SVNlog.cc

    r646 r784  
    22
    33/*
    4   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
     
    2927#include <algorithm>
    3028#include <cassert>
     29#include <stdexcept>
     30#include <sstream>
    3131#include <string>
    32 #include <vector>
    3332
    3433namespace theplu {
     
    5655  {
    5756   
    58     std::vector<Commitment>::const_reverse_iterator iter = commits().rbegin();
     57    SVNlog::container::const_reverse_iterator iter = commits().rbegin();
    5958    for ( ; iter!= commits().rend(); ++iter)
    6059      if (iter->author() == name)
     
    6665  const Commitment& SVNlog::latest_commit(void) const
    6766  {
    68     return commits().back();
     67    assert(commits().size());
     68    return *commits().rbegin();
    6969  }
    7070
     
    7272  const Commitment& SVNlog::latest_commit(std::string name) const
    7373  {
    74     std::vector<Commitment>::const_reverse_iterator iter = commits().rbegin();
     74    SVNlog::container::const_reverse_iterator iter = commits().rbegin();
    7575    for ( ; iter!= commits().rend(); ++iter)
    7676      if (iter->author() == name)
    7777        return *iter;
    78     assert(false);
     78    std::stringstream ss;
     79    ss << __FILE__ << " could not find author: " << name;
     80    throw std::runtime_error(ss.str());
     81    // let us return something to avoid compiler warnings
     82    return *commits().begin();
    7983  }
    8084
     
    9599    if (msg)
    96100      message = msg;
    97     lb->commits.push_back(Commitment(a, date, message, rev));
     101    lb->commits.insert(lb->commits.end(), Commitment(a, date, message, rev));
    98102    return SVN_NO_ERROR;
    99103  }
     
    108112  SVNlog& operator+=(SVNlog& lhs, const SVNlog& rhs)
    109113  {
    110     SVNlog log;
    111     std::vector<Commitment>::iterator lhs_iter=lhs.commits().begin();
    112     std::vector<Commitment>::const_iterator rhs_iter=rhs.commits().begin();
    113     while(lhs_iter<lhs.commits().end() && rhs_iter<rhs.commits().end()) {
    114       if (lhs_iter->revision() < rhs_iter->revision()) {
    115        
    116         log.commits().push_back(*lhs_iter);
    117         ++lhs_iter;
    118       }
    119       else if (rhs_iter->revision()<lhs_iter->revision()) {
    120         log.commits().push_back(*rhs_iter);
    121         ++rhs_iter;
    122       }
    123       else {
    124         log.commits().push_back(*lhs_iter);
    125         ++lhs_iter;
    126         ++rhs_iter;
    127       }
    128     }
    129     while(lhs_iter<lhs.commits().end()) {
    130       log.commits().push_back(*lhs_iter);
    131       ++lhs_iter;
    132     }
    133     while(rhs_iter<rhs.commits().end()) {
    134       log.commits().push_back(*rhs_iter);
    135       ++rhs_iter;
    136     }
    137     lhs.swap(log);
     114    lhs.commits().insert(rhs.commits().begin(), rhs.commits().end());
    138115    return lhs;
    139116  }
  • branches/replacing_gnuplot/lib/SVNlog.h

    r646 r784  
    66/*
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2008 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
     
    3029
    3130#include <string>
    32 #include <vector>
     31#include <set>
    3332
    3433#include <subversion-1/svn_client.h>
     
    4645  class SVNlog {
    4746  public:
     47    /**
     48       container used to store log
     49     */
     50    typedef std::set<Commitment, LessRevision> container;
     51
    4852    /**
    4953       Default constructor. Creates empty log.
     
    6771       \return Commitments
    6872    */
    69     inline const std::vector<Commitment>& commits(void) const
     73    inline const container& commits(void) const
    7074    { return lb_.commits; }
    7175
     
    7377       \return Commitments
    7478    */
    75     inline std::vector<Commitment>& commits(void)
     79    inline container& commits(void)
    7680    { return lb_.commits; }
    7781
     
    112116    */
    113117    struct log_receiver_baton {
    114       std::vector<Commitment> commits;
     118      container commits;
    115119    } lb_;
    116120
  • branches/replacing_gnuplot/lib/SVNproperty.cc

    r519 r784  
    33/*
    44  Copyright (C) 2006 Jari Häkkinen
     5  Copyright (C) 2007, 2008 Peter Johansson
    56
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
  • branches/replacing_gnuplot/lib/SVNproperty.h

    r519 r784  
    66/*
    77  Copyright (C) 2006 Jari Häkkinen
     8  Copyright (C) 2007, 2008 Peter Johansson
    89
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1011
    1112  svndigest is free software; you can redistribute it and/or modify it
    1213  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     14  the Free Software Foundation; either version 3 of the License, or
    1415  (at your option) any later version.
    1516
     
    2021
    2122  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2524*/
    2625
  • branches/replacing_gnuplot/lib/Stats.cc

    r646 r784  
    44  Copyright (C) 2005 Peter Johansson
    55  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  Copyright (C) 2008 Peter Johansson
     7
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
     
    6665
    6766
    68   void Stats::accumulate(std::vector<unsigned int>& vec) const
    69   {
     67  void Stats::accumulate(std::vector<unsigned int>& vec,
     68                         svn_revnum_t rev) const
     69  {
     70    assert(rev>0);
    7071    if (vec.empty()){
    7172      // just to allow call to vec.back() below
    7273      vec.resize(1,0);
    7374    }
    74     else
    75       std::partial_sum(vec.begin(),vec.end(),vec.begin());
     75    else if (vec.begin()+rev-1 < vec.end())
     76      std::partial_sum(vec.begin()+rev-1,vec.end(),vec.begin()+rev-1);
    7677    // static_cast to remove annoying compiler warning
    7778    if (vec.size() < static_cast<size_t>(revision()+1))
     
    8081
    8182
    82   void Stats::accumulate_stats(void)
    83   {
     83  void Stats::accumulate_stats(svn_revnum_t rev)
     84  {
     85    if (!rev)
     86      rev = 1;
    8487    for (std::set<std::string>::const_iterator iter(authors().begin());
    8588         iter!=authors().end(); ++iter) {
    8689      std::vector<unsigned int>& code = code_stats()[*iter];
    87       accumulate(code);
     90      accumulate(code, rev);
    8891      std::vector<unsigned int>& comments = comment_stats()[*iter];
    89       accumulate(comments);
     92      accumulate(comments, rev);
    9093      std::vector<unsigned int>& other = other_stats()[*iter];
    91       accumulate(other);
     94      accumulate(other, rev);
    9295      std::vector<unsigned int>& copyright = copyright_stats()[*iter];
    93       accumulate(copyright);
     96      accumulate(copyright, rev);
    9497    }
    9598  }
     
    266269        ss >> rev;
    267270        ss >> count;
     271        assert(rev<=revision_);
    268272        if (!count)
    269273          break;
    270         if (rev+1 < static_cast<svn_revnum_t>(vec.size()) )
    271           vec.resize(rev+1);
     274        vec.resize(std::max(vec.size(),static_cast<size_t>(rev+1)));
    272275        vec[rev]=count;
    273276      }
     
    277280
    278281
    279   bool Stats::load_cache(std::istream& is)
     282  svn_revnum_t Stats::load_cache(std::istream& is)
    280283  {
    281284    std::string str;
    282285    getline(is, str);
    283286    if (str!=cache_check_str())
    284       return false;
     287      return 0;
    285288    svn_revnum_t rev;
    286289    is >> rev;
    287     if (rev<last_changed_rev()){
    288       return false; // cache is not up to date
    289     }
    290290    reset();
    291291    size_t a_size=0;
     
    297297    }
    298298    getline(is, str);
    299     if (str!=cache_check_str())
    300       return false;
     299    if (str!=cache_check_str()) {
     300      return 0;
     301    }
    301302    for (size_t i=0; i<stats_.size(); ++i){
    302303      load(is, stats_[i]);
    303304      getline(is, str);
    304       if (str!=cache_check_str())
    305         return false;
    306     }
    307     return true;
     305      if (str!=cache_check_str()) {
     306        return 0;
     307      }
     308    }
     309    return rev;
    308310  }
    309311
     
    335337
    336338
    337   void Stats::parse(const std::string& path)
    338   {
    339     do_parse(path);
     339  void Stats::parse(const std::string& path, svn_revnum_t rev)
     340  {
     341    do_parse(path, rev);
    340342    calc_comment_or_copy();
    341343    calc_total();
     
    510512    for (size_t i=0; i<stats_.size(); ++i){
    511513      stats_[i].clear();
    512       stats_[i]["all"]=std::vector<unsigned int>(revision_+1);
     514      std::vector<unsigned int>& tmp = stats_[i]["all"];
     515      std::fill(tmp.begin(), tmp.end(), 0);
     516      tmp.resize(revision_+1);
    513517    }
    514518    authors_.clear();
  • branches/replacing_gnuplot/lib/Stats.h

    r646 r784  
    77  Copyright (C) 2005 Peter Johansson
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    9   Copyright (C) 2007 Peter Johansson
    10 
    11   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  Copyright (C) 2007, 2008 Peter Johansson
     10
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1212
    1313  svndigest is free software; you can redistribute it and/or modify it
    1414  under the terms of the GNU General Public License as published by
    15   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1616  (at your option) any later version.
    1717
     
    2222
    2323  You should have received a copy of the GNU General Public License
    24   along with this program; if not, write to the Free Software
    25   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    26   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2725*/
    2826
     
    6866
    6967    ///
    70     ///
     68    /// \return number of code lines for \a user for latest revision.
    7169    ///
    7270    unsigned int code(const std::string& user="all") const;
     
    7472
    7573    ///
    76     ///
     74    /// \return number of comments lines for \a user for latest revision.
    7775    ///
    7876    unsigned int comments(const std::string& user="all") const;
    7977
    8078    ///
    81     ///
     79    /// \return number of empty lines for \a user for latest revision.
    8280    ///
    8381    unsigned int empty(const std::string& user="all") const;
    8482
    8583    ///
    86     ///
     84    /// \return revison node was modified
    8785    ///
    8886    svn_revnum_t last_changed_rev(void) const;
    8987
    9088    ///
    91     ///
     89    /// \return number of lines for \a user for latest revision
    9290    ///
    9391    unsigned int lines(const std::string& user="all") const;
     
    9694       Load object from a stream.
    9795       
    98        \return true if successful
    99      */
    100     bool load_cache(std::istream&);
    101 
    102     /**
    103        Do the parsing
     96       \return revision the cache represents - 0 if failed
     97     */
     98    svn_revnum_t load_cache(std::istream&);
     99
     100    /**
     101       Do the parsing for \a path. Revisions from \a rev will be parsed.
    104102    */
    105     void parse(const std::string&);
     103    void parse(const std::string& path, svn_revnum_t rev=0);
    106104
    107105    ///
     
    149147    typedef Author2Vector::const_iterator A2VConstIter;
    150148
    151     void accumulate_stats(void);
     149    /**
     150       Calculate accumalated statistics for fundamental statistics,
     151       i.e., code, comment, empty, and copyright for each author.
     152       \see accumulate
     153     */
     154    void accumulate_stats(svn_revnum_t rev=1);
    152155    void add_author(std::string);
    153156    void add_authors(std::set<std::string>::const_iterator,
     
    199202                                         std::string user) const;
    200203  private:
    201     void accumulate(std::vector<unsigned int>& vec) const;
     204    /**
     205       \a vec is resized to revision().
     206       vec is accumulated such that
     207       vec[rev] = vec[rev-1] + vec[rev]
     208       vec[rev+1] = vec[rev] + vec[rev+1]
     209       et cetera
     210     */
     211    void accumulate(std::vector<unsigned int>& vec,
     212                    svn_revnum_t rev=1) const;
    202213    void add(std::vector<unsigned int>& vec, unsigned int rev, bool x,
    203214             unsigned int n);
    204215
    205     virtual void do_parse(const std::string&)=0;
     216    /**
     217       Parse statistics for fundamental categories, i.e., code,
     218       comment, empty, and copyright for each author. Ignore revisions
     219       earlier than \a first_rev.
     220     */
     221    virtual void do_parse(const std::string&, svn_revnum_t first_rev)=0;
    206222   
    207223    // Change this string if cache format is changed in such a way
    208224    // that all old cache files are obsolete.
    209225    inline std::string cache_check_str(void) const
    210     {return "CACHE FILE VERSION 5";}
     226    {return "CACHE FILE VERSION 6";}
    211227
    212228    void calc_all(void);
  • branches/replacing_gnuplot/lib/StatsCollection.cc

    r543 r784  
    44  Copyright (C) 2007 Peter Johansson
    55
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    77
    88  svndigest is free software; you can redistribute it and/or modify it
    99  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     10  the Free Software Foundation; either version 3 of the License, or
    1111  (at your option) any later version.
    1212
     
    1717
    1818  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2220*/
    2321
     
    6361    bool result = true;
    6462    for (map::const_iterator i(stats_.begin()); i!=stats_.end(); ++i) {
    65       if(!i->second->load_cache(is)){
     63      svn_revnum_t cache_rev = i->second->load_cache(is);
     64      if (cache_rev < i->second->last_changed_rev()) {
     65        cache_rev=0; // tmp hack to avoid partial cache
    6666        result = false;
    67         i->second->reset();
    68         i->second->parse(path_);
     67        // reset if load cache failed
     68        if (!cache_rev)
     69          i->second->reset();
     70        i->second->parse(path_, cache_rev+1);
    6971      }
    7072    }
  • branches/replacing_gnuplot/lib/StatsCollection.h

    r538 r784  
    99  Copyright (C) 2007 Peter Johansson
    1010
    11   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1212
    1313  svndigest is free software; you can redistribute it and/or modify it
    1414  under the terms of the GNU General Public License as published by
    15   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1616  (at your option) any later version.
    1717
     
    2222
    2323  You should have received a copy of the GNU General Public License
    24   along with this program; if not, write to the Free Software
    25   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    26   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2725*/
    2826
  • branches/replacing_gnuplot/lib/Trac.cc

    r519 r784  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    5 
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     5  Copyright (C) 2008, 2009 Peter Johansson
     6
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
     
    5049
    5150
    52   bool Trac::changeset(std::string::const_iterator& first,
     51  bool Trac::changeset(const std::string::const_iterator& first,
     52                       std::string::const_iterator& iter,
    5353                       const std::string::const_iterator& last,
    5454                       const std::string::const_iterator& last_trunc)
    5555  {
    56     if (changeset1(first, last, last_trunc))
    57       return true;
    58     if (changeset2(first, last, last_trunc))
    59       return true;
    60     if (changeset3(first, last, last_trunc))
     56    if (changeset1(first, iter, last, last_trunc))
     57      return true;
     58    if (changeset2(iter, last, last_trunc))
     59      return true;
     60    if (changeset3(iter, last, last_trunc))
    6161      return true;
    6262    return false;
     
    6464
    6565
    66   bool Trac::changeset1(std::string::const_iterator& first,
     66  bool Trac::changeset1(const std::string::const_iterator& first,
     67                        std::string::const_iterator& iter,
    6768                        const std::string::const_iterator& last,
    6869                        const std::string::const_iterator& last_trunc)
    6970  {
    70     if (first==last)
    71       return false;
    72     if (*first != 'r')
    73       return false;
    74     const std::string::const_iterator first_orig(first);
    75     ++first;
    76     std::string rev = match(first, last, Digit());
    77     if (rev.empty()){
    78       first = first_orig;
     71    if (iter==last)
     72      return false;
     73    if (*iter != 'r')
     74      return false;
     75    if (iter!=first && isalnum(*(iter-1)))
     76      return false;
     77    const std::string::const_iterator iter_orig(iter);
     78    ++iter;
     79    std::string rev = match(iter, last, Digit());
     80    if (rev.empty() || (iter!=last && (std::isalnum(*iter) || *iter==':')) ){
     81      iter = iter_orig;
    7982      return false;
    8083    }
    8184    std::string href(Configuration::instance().trac_root()+"changeset/"+rev);
    82     hs_.stream() << anchor(href, anchor_text(first_orig, first, last_trunc));
     85    hs_.stream() << anchor(href, anchor_text(iter_orig, iter, last_trunc));
    8386    return true;
    8487  }
     
    290293
    291294
    292   bool Trac::log(std::string::const_iterator& first,
     295  bool Trac::log(const std::string::const_iterator& first,
     296                 std::string::const_iterator& iter,
    293297                 const std::string::const_iterator& last,
    294298                 const std::string::const_iterator& last_trunc)
    295299  {
    296     if (log1(first, last, last_trunc))
    297       return true;
    298     if (log2(first, last, last_trunc))
    299       return true;
    300     if (log3(first, last, last_trunc))
     300    if (log1(first, iter, last, last_trunc))
     301      return true;
     302    if (log2(iter, last, last_trunc))
     303      return true;
     304    if (log3(iter, last, last_trunc))
    301305      return true;
    302306    return false;
     
    304308
    305309
    306   bool Trac::log1(std::string::const_iterator& first,
     310  bool Trac::log1(const std::string::const_iterator& first,
     311                  std::string::const_iterator& iter,
    307312                  const std::string::const_iterator& last,
    308313                  const std::string::const_iterator& last_trunc)
    309314  {
    310     if (first==last)
    311       return false;
    312 
    313     const std::string::const_iterator first_orig(first);
    314     if (*first != 'r')
    315       return false;
    316     ++first;
    317 
    318     std::string stop_rev = match(first, last, AlNum());
    319     if (stop_rev.empty() || first == last || *first != ':') {
    320       first = first_orig;
    321       return false;
    322     }
    323     ++first;
    324     std::string rev = match(first, last, AlNum());
    325     if (rev.empty() ) {
    326       first = first_orig;
     315    if (iter==last)
     316      return false;
     317
     318    const std::string::const_iterator iter_orig(iter);
     319    if (*iter != 'r')
     320      return false;
     321    if (iter!=first && isalnum(*(iter-1)))
     322      return false;
     323    ++iter;
     324
     325    std::string stop_rev = match(iter, last, Digit());
     326    if (stop_rev.empty() || iter == last || *iter != ':') {
     327      iter = iter_orig;
     328      return false;
     329    }
     330    ++iter;
     331    std::string rev = match(iter, last, Digit());
     332    if (rev.empty() || (iter!=last && std::isalnum(*iter) ) ){
     333      iter = iter_orig;
    327334      return false;
    328335    }
    329336    std::string href(Configuration::instance().trac_root()+"log/?rev="+
    330337                     rev+"&amp;stop_rev="+stop_rev);
    331     hs_.stream() << anchor(href, anchor_text(first_orig,first, last_trunc));
     338    hs_.stream() << anchor(href, anchor_text(iter_orig,iter, last_trunc));
    332339    return true;
    333340  }
     
    447454      last_trunc = first+width;
    448455    while (first<last_trunc) {
    449       if (log(first, str.end(), last_trunc))
     456      if (log(str.begin(), first, str.end(), last_trunc))
    450457        continue;
    451458      if (comment(first, str.end(), last_trunc))
     
    453460      if (ticket(first, str.end(), last_trunc))
    454461        continue;
    455       if (changeset(first, str.end(), last_trunc))
     462      if (changeset(str.begin(), first, str.end(), last_trunc))
    456463        continue;
    457464      if (diff(first, str.end(), last_trunc))
  • branches/replacing_gnuplot/lib/Trac.h

    r519 r784  
    55
    66/*
    7   Copyright (C) 2007 Peter Johansson
    8 
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  Copyright (C) 2007, 2008, 2009 Peter Johansson
     8
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
     
    6058    /// @return true if any of changesetX returns true
    6159    ///
    62     bool changeset(std::string::const_iterator& first,
     60    bool changeset(const std::string::const_iterator& first,
     61                   std::string::const_iterator& iter,
    6362                   const std::string::const_iterator& last,
    6463                   const std::string::const_iterator& last_trunc);
     
    6867    ///
    6968    /// Search in range [\a first, \a last) for expression
    70     /// /r(\d+)/. If expression is found an anchor to
    71     /// trac-root/changeset/123, displaying expression, and first is
    72     /// pointing to character after expression.
    73     ///
    74     /// @return true if expression is found
    75     ///
    76     bool changeset1(std::string::const_iterator& first,
     69    /// /r(\d+)/. In addition character before cannot be
     70    /// alpha-numeric, and character after expression cannot be
     71    /// alpha-numeric or ':' (beginning/end of string is allowed). If
     72    /// expression is found an anchor to trac-root/changeset/123,
     73    /// displaying expression, and first is pointing to character
     74    /// after expression.
     75    ///
     76    /// @return true if expression is found
     77    ///
     78    bool changeset1(const std::string::const_iterator& first,
     79                    std::string::const_iterator& iter,
    7780                    const std::string::const_iterator& last,
    7881                    const std::string::const_iterator& last_trunc);
     
    189192    /// @return true if any of logX returns true
    190193    ///
    191     bool log(std::string::const_iterator& first,
     194    bool log(const std::string::const_iterator& first,
     195             std::string::const_iterator& iter,
    192196             const std::string::const_iterator& last,
    193197             const std::string::const_iterator& last_trunc);
     
    197201    ///
    198202    /// Search in range [\a first, \a last) for expression
    199     /// /r(\w+):(\w+)/. If expression is found an
    200     /// anchor is created, displaying the expression, and first is
    201     /// pointing to character after expression.
     203    /// /r(\d+):(\d+)/. In addition character before and after
     204    /// expression cannot be alpha-numeric (beginning/end of string is
     205    /// allowed). If expression is found an anchor is created,
     206    /// displaying the expression, and iter is pointing to character
     207    /// after expression.
    202208    ///
    203209    /// The created anchor goes to trac-root/log/?rev=236&stop_rev=123
     
    205211    /// @return true if expression is found
    206212    ///
    207     bool log1(std::string::const_iterator& first,
     213    bool log1(const std::string::const_iterator& first,
     214              std::string::const_iterator& iter,
    208215              const std::string::const_iterator& last,
    209216              const std::string::const_iterator& last_trunc);
  • branches/replacing_gnuplot/lib/css.cc

    r519 r784  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  Copyright (C) 2009 Peter Johansson
     7
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
     
    3837
    3938      << "Copyright (C) 2006 Peter Johansson\n"
    40       << "Copyright (C) 2007 Jari Häkkinen, Peter Johansson\n\n"
    41       << "This file is part of svndigest, "
    42       << "http://trac.thep.lu.se/svndigest\n\n"
     39      << "Copyright (C) 2007 Jari Häkkinen, Peter Johansson\n"
     40      << "Copyright (C) 2009 Peter Johansson\n"
     41      << "\nThis file is part of svndigest, "
     42      << "http://dev.thep.lu.se/svndigest\n\n"
    4343
    4444      << "svndigest is free software; you can redistribute it and/or "
    4545      << "modify it\n"
    4646      << "under the terms of the GNU General Public License as published by\n"
    47       << "the Free Software Foundation; either version 2 of the License, or\n"
     47      << "the Free Software Foundation; either version 3 of the License, or\n"
    4848      << "(at your option) any later version.\n\n"
    4949
     
    5454
    5555      << "You should have received a copy of the GNU General Public License\n"
    56       << "along with this program; if not, write to the Free Software\n"
    57       << "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
    58       << "02111-1307, USA.\n\n"
    59 
    60       << "This file was initially inspired by the cascading style sheet\n"
     56      << "along with svndigest. If not, see <http://www.gnu.org/licenses/>.\n"
     57
     58      << "\n\nThis file was initially inspired by the cascading style sheet\n"
    6159      << "within the Trac open source project (http://trac.edgewall.org/)\n"
    6260      << "Copyright (C) 2003-2006 Edgewall Software\n"
  • branches/replacing_gnuplot/lib/css.h

    r519 r784  
    55
    66/*
    7   Copyright (C) 2006, 2007 Peter Johansson
     7  Copyright (C) 2006, 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/first_page.cc

    r646 r784  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  Copyright (C) 2009 Peter Johansson
     7
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
     
    6059    set<string> authors;
    6160    std::transform(log.commits().begin(), log.commits().end(),
    62                    std::inserter(authors, authors.begin()), GetAuthor());
     61                   std::inserter(authors, authors.begin()),
     62                   std::mem_fun_ref(&Commitment::author));
    6363    // erase invalid authors
    6464    authors.erase("");
     
    8484  {
    8585    assert(log.commits().size());
    86     Date begin(log.commits()[0].date());
    87     Date end(log.commits().back().date());
    88     std::string timefmt("%a, %e %b %Y  %H:%M:%S");
     86    Date begin(log.commits().begin()->date());   
     87    Date end(log.latest_commit().date());
     88    std::string timefmt("%a %b %e %H:%M:%S %Y");
    8989
    9090    os << "<div class=\"main\">"
     
    102102    os << end.difftime(begin);
    103103    os << "</td></tr>\n"
    104        << "<tr><td>Smallest Revision:</td><td>" << log.commits()[0].revision()
    105        << "</td></tr>\n"
    106        << "<tr><td>Largest Revision:</td><td>" <<log.commits().back().revision()
     104       << "<tr><td>Smallest Revision:</td><td>"
     105       << log.commits().begin()->revision()
     106       << "</td></tr>\n"
     107       << "<tr><td>Largest Revision:</td><td>" << log.latest_commit().revision()
    107108       << "</td></tr>\n"
    108109       << "<tr><td>Revision Count:</td><td>" << log.commits().size()
     
    119120                     const Stats& stats)
    120121  {
     122    HtmlStream hs(os);
    121123    os << "<div class=\"main\">"
    122124       << "<table class=\"main\"><thead><tr><th colspan=\"2\">"
     
    131133       <<"</tr>";
    132134
    133     std::string timefmt("%Y %b %d %H:%M:%S");
     135    std::string timefmt("%Y-%m-%d  %H:%M");
    134136    using namespace std;
    135137    for (vector<Commitment>::const_iterator i=lc.begin(); i!=lc.end(); ++i) {
     
    146148         << "%)</td><td>" << stats.comments(i->author()) << " ("
    147149         << 100*stats.comments(i->author())/(stats.comments()?stats.comments():1)
    148          << "%)</td><td>" << Date(i->date())(timefmt) << "</td>" <<"</tr>";
     150         << "%)</td><td>";
     151      hs << Date(i->date())(timefmt);
     152      os << "</td>" <<"</tr>";
    149153    }
    150154    os << "<tr><td>Total</td>";
     
    169173       << "<td>Removed</td><td>Message</td></tr>\n";
    170174    HtmlStream hs(os);
    171     std::string timefmt("%Y %b %d %H:%M:%S");
     175    std::string timefmt("%Y-%m-%d  %H:%M");
    172176    const size_t maxlength = 80;
    173177    const Configuration& conf = Configuration::instance();
    174     typedef std::vector<Commitment>::const_reverse_iterator iter;
     178    typedef SVNlog::container::const_reverse_iterator iter;
     179    size_t count = 0;
    175180    for (iter i=log.commits().rbegin();
    176          i < std::min(i+10,log.commits().rend()); ++i) {
     181         i != log.commits().rend() && count<10; ++i) {
    177182      os << "<tr><td>"
    178183         << anchor(std::string("classic/")+i->author()+"/total/index.html",
     
    180185         << "</td>";
    181186      Date date(i->date());
    182       os << "<td>" << date(timefmt) << "</td>";
     187      os << "<td>";
     188      hs << date(timefmt);
     189      os << "</td>";
    183190      os << "<td>";
    184191      os << trac_revision(i->revision());
     
    211218
    212219      os << "</td></tr>\n";
     220      ++count;
    213221    }
    214222    os << "</table></div>\n";
  • branches/replacing_gnuplot/lib/first_page.h

    r556 r784  
    55
    66/*
    7   Copyright (C) 2006, 2007 Peter Johansson
     7  Copyright (C) 2006, 2007, 2008 Peter Johansson
    88
    9   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1010
    1111  svndigest is free software; you can redistribute it and/or modify it
    1212  under the terms of the GNU General Public License as published by
    13   the Free Software Foundation; either version 2 of the License, or
     13  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    1515
     
    2020
    2121  You should have received a copy of the GNU General Public License
    22   along with this program; if not, write to the Free Software
    23   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    24   02111-1307, USA.
     22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2523*/
    2624
  • branches/replacing_gnuplot/lib/html_utility.cc

    r646 r784  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    6 
    7   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     6  Copyright (C) 2009 Peter Johansson
     7
     8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    89
    910  svndigest is free software; you can redistribute it and/or modify it
    1011  under the terms of the GNU General Public License as published by
    11   the Free Software Foundation; either version 2 of the License, or
     12  the Free Software Foundation; either version 3 of the License, or
    1213  (at your option) any later version.
    1314
     
    1819
    1920  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22   02111-1307, USA.
     21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2322*/
    2423
     24#include <config.h>
     25
    2526#include "html_utility.h"
    2627
    27 #include "config.h"
    2828#include "Configuration.h"
    2929#include "Date.h"
    3030#include "HtmlStream.h"
    3131#include "subversion_info.h"
    32 #include <config.h> // this header file is created by configure
    3332
    3433#include <sstream>
     
    6564  {
    6665    Date date;
    67     os << "<p class=\"footer\">\nGenerated on "
    68        << date("%a %b %d %H:%M:%S %Y") << " (UTC) by "
    69        << anchor("http://trac.thep.lu.se/svndigest/",
     66    HtmlStream hs(os);
     67    os << "<p class=\"footer\">\nGenerated on ";
     68    hs << date("%a %b %e %H:%M:%S %Y") << " (UTC) by ";
     69    os << anchor("http://dev.thep.lu.se/svndigest/",
    7070                 PACKAGE_STRING, 0, "");
    7171    if (DEV_BUILD)
    72       os << " (dev build r" << svn_revision() << ")";
     72      os << " (dev build " << svn_revision() << ")";
    7373    os << "\n</p>\n</div>\n</body>\n</html>\n";
    7474  }
     
    7878                    std::string user, std::string item, std::string path,
    7979                    const std::string& stats)
     80  {
     81    print_html_start(os, title, level);
     82    os << "<div id=\"menu\">"
     83       << "<ul>\n<li></li>\n";
     84    if (item=="main")
     85      os << "<li class=\"highlight\">";
     86    else
     87      os << "<li>";
     88    os << anchor("index.html", "Main", level, "Main page");
     89    os << "</li>\n";
     90
     91    std::string stats_local(stats);
     92    if (stats_local=="none")
     93      stats_local = "classic";
     94
     95    if (item=="total")
     96      os << "<li class=\"highlight\">";
     97    else
     98      os << "<li>\n";
     99    os << anchor(stats_local+"/"+user+"/total/"+path, "Total", level,
     100           "View statistics of all lines");
     101    os << "</li>\n";
     102
     103    if (item=="code")
     104      os << "<li class=\"highlight\">";
     105    else
     106      os << "<li>";
     107    os << anchor(stats_local+"/"+user+"/code/"+path, "Code", level,
     108                 "View statistics of code lines");
     109    os << "</li>\n";
     110
     111    if (item=="comments")
     112      os << "<li class=\"highlight\">";
     113    else
     114      os << "<li>";
     115    os << anchor(stats_local+"/"+user+"/comments/"+path, "Comment", level,
     116                 "View statistics of comment lines");
     117    os << "</li>\n";
     118
     119
     120    if (item=="empty")
     121      os << "<li class=\"highlight\">";
     122    else
     123      os << "<li>";
     124    os << anchor(stats_local+"/"+user+"/empty/"+path, "Other", level,
     125                 "View statistics of other lines");
     126    os << "</li>\n";
     127    os << "<li>";
     128    // Peter, this is ugly! But how to add space?
     129    for (size_t i=0; i<50; ++i)
     130      os << "&nbsp;";
     131    os << "</li>\n";
     132
     133    std::string item_local(item);
     134    if (item_local=="none")
     135      item_local = "total";
     136    if (item_local=="main")
     137      item_local = "total";
     138
     139    if (stats=="classic")
     140      os << "<li class=\"highlight\">";
     141    else
     142      os << "<li>";
     143    os << anchor("classic/"+user+"/"+item_local+"/"+path, "Classic", level,
     144                 "View classic statistics");
     145    os << "</li>\n";
     146
     147    if (stats=="blame")
     148      os << "<li class=\"highlight\">";
     149    else
     150      os << "<li>";
     151    os << anchor("blame/"+user+"/"+item_local+"/"+path, "Blame", level,
     152                 "View blame statistics");
     153    os << "</li>\n";
     154
     155    if (stats=="add")
     156      os << "<li class=\"highlight\">";
     157    else
     158      os << "<li>";
     159    os << anchor("add/"+user+"/"+item_local+"/"+path, "Add", level,
     160                 "View add statistics");
     161    os << "</li>\n";
     162
     163
     164    os << "</li>\n"
     165       << "</ul></div>\n"
     166       << "<div id=\"main\">\n";
     167  }
     168
     169
     170  void print_html_start(std::ostream& os, const std::string& title,
     171                        unsigned int level)
    80172  {
    81173    os << "<!-- Generated by " << PACKAGE_STRING << "-->\n";
     
    93185    os << "svndigest.css\" type=\"text/css\" />\n"
    94186       << "</head>\n"
    95        << "<body>\n"
    96        << "<div id=\"menu\">"
    97        << "<ul>\n<li></li>\n";
    98     if (item=="main")
    99       os << "<li class=\"highlight\">";
    100     else
    101       os << "<li>";
    102     os << anchor("index.html", "Main", level, "Main page");
    103     os << "</li>\n";
    104 
    105     std::string stats_local(stats);
    106     if (stats_local=="none")
    107       stats_local = "classic";
    108 
    109     if (item=="total")
    110       os << "<li class=\"highlight\">";
    111     else
    112       os << "<li>\n";
    113     os << anchor(stats_local+"/"+user+"/total/"+path, "Total", level,
    114            "View statistics of all lines");
    115     os << "</li>\n";
    116 
    117     if (item=="code")
    118       os << "<li class=\"highlight\">";
    119     else
    120       os << "<li>";
    121     os << anchor(stats_local+"/"+user+"/code/"+path, "Code", level,
    122                  "View statistics of code lines");
    123     os << "</li>\n";
    124 
    125     if (item=="comments")
    126       os << "<li class=\"highlight\">";
    127     else
    128       os << "<li>";
    129     os << anchor(stats_local+"/"+user+"/comments/"+path, "Comment", level,
    130                  "View statistics of comment lines");
    131     os << "</li>\n";
    132 
    133 
    134     if (item=="empty")
    135       os << "<li class=\"highlight\">";
    136     else
    137       os << "<li>";
    138     os << anchor(stats_local+"/"+user+"/empty/"+path, "Other", level,
    139                  "View statistics of other lines");
    140     os << "</li>\n";
    141     os << "<li>";
    142     // Peter, this is ugly! But how to add space?
    143     for (size_t i=0; i<50; ++i)
    144       os << "&nbsp;";
    145     os << "</li>\n";
    146 
    147     std::string item_local(item);
    148     if (item_local=="none")
    149       item_local = "total";
    150     if (item_local=="main")
    151       item_local = "total";
    152 
    153     if (stats=="classic")
    154       os << "<li class=\"highlight\">";
    155     else
    156       os << "<li>";
    157     os << anchor("classic/"+user+"/"+item_local+"/"+path, "Classic", level,
    158                  "View classic statistics");
    159     os << "</li>\n";
    160 
    161     if (stats=="blame")
    162       os << "<li class=\"highlight\">";
    163     else
    164       os << "<li>";
    165     os << anchor("blame/"+user+"/"+item_local+"/"+path, "Blame", level,
    166                  "View blame statistics");
    167     os << "</li>\n";
    168 
    169     if (stats=="add")
    170       os << "<li class=\"highlight\">";
    171     else
    172       os << "<li>";
    173     os << anchor("add/"+user+"/"+item_local+"/"+path, "Add", level,
    174                  "View add statistics");
    175     os << "</li>\n";
    176 
    177 
    178     os << "</li>\n"
    179        << "</ul></div>\n"
    180        << "<div id=\"main\">\n";
    181   }
    182 
     187       << "<body>\n";
     188  }
    183189
    184190  std::string trac_revision(svn_revnum_t r, std::string color)
  • branches/replacing_gnuplot/lib/html_utility.h

    r646 r784  
    66/*
    77  Copyright (C) 2006 Peter Johansson
    8   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2008 Peter Johansson
    910
    10   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    1112
    1213  svndigest is free software; you can redistribute it and/or modify it
    1314  under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 2 of the License, or
     15  the Free Software Foundation; either version 3 of the License, or
    1516  (at your option) any later version.
    1617
     
    2122
    2223  You should have received a copy of the GNU General Public License
    23   along with this program; if not, write to the Free Software
    24   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    25   02111-1307, USA.
     24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2625*/
    2726
     
    6968
    7069
     70  /**
     71     \brief print html start
     72
     73     Just like print_header, this function outputs start of html page,
     74     but in contrast to print_header there are no menus in the otput
     75     of this function.
     76   */
     77  void print_html_start(std::ostream& os, const std::string& title,
     78                        unsigned int level);
     79
     80
    7181  ///
    7282  /// @return if trac-revision is set in config file anchor to trac is
  • branches/replacing_gnuplot/lib/rmdirhier.cc

    r519 r784  
    22
    33/*
    4   Copyright (C) 2006 Jari Häkkinen, Peter Johansson
     4  Copyright (C) 2006 Jari Häkkinen
     5  Copyright (C) 2007, 2008 Peter Johansson
    56
    6   This file is part of svndigest, http://trac.thep.lu.se/svndigest
     7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
    78
    89  svndigest is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    10   the Free Software Foundation; either version 2 of the License, or
     11  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
     
    1718
    1819  You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    21   02111-1307, USA.
     20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2221*/
    2322
     
    6463  void rmdirhier__(const std::string& dir)
    6564  {
     65    struct stat buf;
     66    // using lstat because links should not be treated as dirs
     67    lstat(dir.c_str(),&buf);
     68    // check if dir - if not delete the node
     69    if (!(buf.st_mode & S_IFDIR)) {
     70      // Make sure file is removable before removing it
     71      chmod(dir.c_str(),S_IWRITE);
     72      if (unlink(dir.c_str()))
     73        throw FileDeleteError(dir);
     74      return;
     75    }
    6676    if (chdir(dir.c_str()))
    6777      throw BadDirectory(dir);
     
    7383      throw DirectoryOpenError(dir);
    7484    while ((entry=readdir(dp)) != NULL) {
    75       struct stat buf;
    7685      if ((std::string(entry->d_name) == ".") ||
    7786          (std::string(entry->d_name) == ".."))
    7887        continue;
    79       stat(entry->d_name,&buf);
    80       if (buf.st_mode & S_IFDIR)
    81         rmdirhier__(entry->d_name);      // sub-directory
    82       else {
    83         // Make sure file is removable before removing it
    84         chmod(entry->d_name,S_IWRITE);
    85         if (unlink(entry->d_name))
    86           throw FileDeleteError(entry->d_name);
    87       }
     88      rmdirhier__(entry->d_name);
    8889    }
    8990    closedir(dp);
  • branches/replacing_gnuplot/lib/rmdirhier.h

    r519 r784  
    55
    66/*
    7   Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2007 Peter Johansson
     7  Copyright (C) 2006 Jari Häkkinen
     8  Copyright (C) 2007, 2008 Peter Johansson
    99