3 #=======================================================================
5 # File ID: 348a6fb6-f744-11dd-87e5-000475e441b9
6 # Generates a gnuplot curve of weekly Subversion commits. Extremely
7 # primitive at the moment.
10 # ©opyleft 2004– Øyvind A. Holm <sunny@sunbase.org>
11 # License: GNU General Public License version 2 or later, see end of
12 # file for legal stuff.
13 #=======================================================================
34 $progname =~ s/^.*\/(.*?)$/$1/;
35 our $VERSION = "0.00";
37 Getopt
::Long
::Configure
("bundling");
40 "debug" => \
$Opt{'debug'},
41 "force|f" => \
$Opt{'force'},
42 "help|h" => \
$Opt{'help'},
43 "verbose|v+" => \
$Opt{'verbose'},
44 "version" => \
$Opt{'version'},
46 ) || die("$progname: Option error. Use -h for help.\n");
48 $Opt{'debug'} && ($Debug = 1);
49 $Opt{'help'} && usage
(0);
50 if ($Opt{'version'}) {
55 my $dat_file = "svnstat.dat";
56 my $tmp_file = "svnstat.tmp";
57 my $ep_file = "svnstat.ep.tmp";
58 my $week_file = "svnstat.week.dat";
59 my $count_file = "svnstat.count.dat";
60 my $time_file = "svnstat.time.dat";
66 $args = join(" ", @ARGV);
71 print("$dat_file exists, but --force was specified.\n");
73 print("$dat_file exists, skipping svn log.\n");
79 print("Running svn log...\n");
80 system("svn log --xml $args >$dat_file");
83 system("LC_ALL=C LC_CTYPE=C grep '<date>' $dat_file | cut -c7-25,33 | sort >$tmp_file");
84 system("deep $tmp_file >$ep_file");
85 system("ep_day -w 1 $ep_file | ep >$week_file");
86 system("stpl -k -t \"Commits per week\" $week_file");
87 system("inc_epstat $tmp_file >$count_file");
88 system("stpl -k -t \"Incrementally number of revisions\" $count_file");
89 system("ep-pause -s $ep_file >$time_file");
90 system("stpl -k -t \"Number of seconds between commits\" $time_file");
96 # Print program version {{{
97 print("$progname v$VERSION\n");
102 # Send the help message to stdout {{{
105 if ($Opt{'verbose'}) {
111 Usage: $progname [options] [file_or_url [...]]
116 Force execution of “svn log”.
120 Increase level of verbosity. Can be repeated.
122 Print version information.
124 Print debugging messages.
132 # Print a status message to stderr based on verbosity level {{{
133 my ($verbose_level, $Txt) = @_;
135 if ($Opt{'verbose'} >= $verbose_level) {
136 print(STDERR
"$progname: $Txt\n");
142 # Print a debugging message {{{
144 my @call_info = caller;
145 chomp(my $Txt = shift);
146 my $File = $call_info[1];
148 $File =~ s
#^.*/(.*?)$#$1#;
149 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
156 # Plain Old Documentation (POD) {{{
166 svnstat [options] [file_or_url [...]]
170 Generate statistics for Subversion commits.
176 =item B<-f>, B<--force>
178 Force “svn log” to run even if F<svnstat.dat> exists.
180 =item B<-h>, B<--help>
182 Print a brief help summary.
184 =item B<-v>, B<--verbose>
186 Increase level of verbosity. Can be repeated.
190 Print version information.
194 Print debugging messages.
200 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
204 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
205 This is free software; see the file F<COPYING> for legalese stuff.
209 This program is free software: you can redistribute it and/or modify it
210 under the terms of the GNU General Public License as published by the
211 Free Software Foundation, either version 2 of the License, or (at your
212 option) any later version.
214 This program is distributed in the hope that it will be useful, but
215 WITHOUT ANY WARRANTY; without even the implied warranty of
216 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
217 See the GNU General Public License for more details.
219 You should have received a copy of the GNU General Public License along
221 If not, see L<http://www.gnu.org/licenses/>.
229 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :