1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#! /usr/bin/perl -w
use warnings;
use strict;
use XML::Simple;
use Data::Dumper;
use Date::Parse;
use Text::Wrap qw(wrap fill);
print "Reading XML...\n";
my $ref = XMLin('-');
my %log;
my %rev;
$Text::Wrap::columns = 79;
print "Parsing log...\n";
foreach my $entry (@{$$ref{'logentry'}}) {
my ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($$entry{'date'});
my $date = sprintf("%04d-%02d-%02d", $year + 1900, $month + 1, $day);
if (! $log{$date}) {
$log{$date} = ();
$rev{$date} = {};
}
push @{$log{$date}},$entry;
$rev{$date}->{$$entry{'revision'}}=1;
# print Dumper($entry);
# print "$date\n";
}
#print Dumper(\%rev);
print "Creating CHANGES...\n";
open(C, ">CHANGES");
foreach my $date (reverse sort keys %log) {
my @revs=sort {$a <=> $b} keys %{$rev{$date}};
my $minrev = $revs[0];
my $maxrev = $revs[$#revs-1];
print C "$date Revision $minrev";
if ($maxrev != $minrev) {
print C "-$maxrev";
}
print C "\n";
my $laststr = "";
foreach my $entry (@{$log{$date}}) {
my $str = $$entry{'msg'};
next if ($str =~ /^HASH\(/);
next if ($str =~ /^\*\*\* empty/);
$str =~ s/\r//g;
$str =~ s/\n+$//g;
# $str =~ s/\n/\n\t /g;
next if ($str eq $laststr);
$laststr = $str;
my $html = $str;
$html =~ s/\n/<br \/>/g;
if ($$entry{'author'} ne "slicer") {
$str .= " [".$$entry{'author'}."]";
}
print C wrap("\t* ","\t ",$str);
print C "\n";
}
}
close(C);
|