summaryrefslogtreecommitdiffstats
path: root/tools/cvslog
blob: 41abbc2eb596c44e9c179810541bf758ea4c895e (plain)
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
#!/usr/bin/perl
# Process `cvs log' output to get a resonable changelog
# (c) 2003--2004 Martin Mares <mj@ucw.cz>

use Digest::MD5;
use POSIX;

my %names= (
	'mj'	=> 'Martin Mares <mj@ucw.cz>',
	'feela'	=> 'Ondrej Filip <feela@network.cz>',
	'pavel' => 'Pavel Machek <pavel@ucw.cz>'
);

while (<STDIN>) {
	chomp;
	/^$/ && next;
	/^[?]/ && next;
	/^RCS file: / || die;
	$_ = <STDIN>;
	chomp;
	my ($file) = /^Working file: (.*)$/ or die;
	#print "$file\n";
	do {
		$_ = <STDIN> or die;
	} while (!/^description:/);
	$_ = <STDIN>;
	for(;;) {
		/^======/ && last;
		if (/^------/) { $_ = <STDIN>; next; }
		/^revision / || die;
		$_ = <STDIN>;
		my ($author) = /;\s*author:\s*([^;]+)/ or die;
		my ($yy,$mm,$dd,$HH,$MM,$SS) = /^date: (....)\/(..)\/(..) (..):(..):(..);/ or die;
		my $t = POSIX::mktime($SS,$MM,$HH,$dd,$mm-1,$yy-1900) or die;
		my $T = sprintf("%06d", int(($t + 1800)/3600));
		$d = "";
		while ($_ = <STDIN>) {
			/^(-----|=====)/ && last;
			$d .= "  $_";
		}
		my $id = "$T:" . Digest::MD5::md5_hex($d);
		if (!defined $msg{$id}) {
			$date{$id} = "$yy-$mm-$dd $HH:$MM:$SS";
			$msg{$id} = $d;
			$files{$id} = "";
			$author{$id} = $author;
		}
		$files{$id} .= "  * $file\n";
		#print "\t$id\n";
	}
}

foreach $id (sort keys %date) {
	if (!exists ($names{$author{$id}})) {
		die "Unknown commiter $author{$id}";
	}
	print "### ", $date{$id}, "  ", $names{$author{$id}}, "\n\n";
	print $files{$id}, "\n";
	print $msg{$id}, "\n";
}