]> mj.ucw.cz Git - libucw.git/blob - build/cvslog
Forgot to add this one.
[libucw.git] / build / cvslog
1 #!/usr/bin/perl
2 # Process `cvs log' output to get a resonable changelog
3 # (c) 2003 Martin Mares <mj@ucw.cz>
4
5 use Digest::MD5;
6 use POSIX;
7
8 while (<STDIN>) {
9         chomp;
10         /^$/ && next;
11         /^RCS file: / || die;
12         $_ = <STDIN>;
13         chomp;
14         my ($file) = /^Working file: (.*)$/ or die;
15         #print "$file\n";
16         do {
17                 $_ = <STDIN> or die;
18         } while (!/^description:/);
19         $_ = <STDIN>;
20         for(;;) {
21                 /^======/ && last;
22                 if (/^------/) { $_ = <STDIN>; next; }
23                 /^revision / || die;
24                 $_ = <STDIN>;
25                 my ($yy,$mm,$dd,$HH,$MM,$SS) = /^date: (....)\/(..)\/(..) (..):(..):(..);/ or die;
26                 my $t = POSIX::mktime($SS,$MM,$HH,$dd,$mm-1,$yy-1900) or die;
27                 my $T = sprintf("%06d", int(($t + 1800)/3600));
28                 $d = "";
29                 while ($_ = <STDIN>) {
30                         /^(-----|=====)/ && last;
31                         $d .= $_;
32                 }
33                 my $id = "$T:" . Digest::MD5::md5_hex($d);
34                 if (!defined $msg{$id}) {
35                         $date{$id} = "$yy-$mm-$dd $HH:$MM:$SS";
36                         $msg{$id} = $d;
37                         $files{$id} = "";
38                 }
39                 $files{$id} .= "\t* $file\n";
40                 #print "\t$id\n";
41         }
42 }
43
44 foreach $id (sort keys %date) {
45         print "### ", $date{$id}, "\n\n";
46         print $files{$id}, "\n";
47         print $msg{$id}, "\n";
48 }