summaryrefslogtreecommitdiffstats
path: root/tools/cvslog2changelog.pl
blob: 2b58ebf55fc61bc0c467bb4d6f900a36b7fc1898 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/perl

while (<>) {
    if ($e = /^description:/ .. /^={77}/) {
	next if $e == 1 || $e =~ /E0/;
	if (/^-{28}/ .. /^date: /) {
	    if (/^date: (\S+)\s.*author: (\S+);/) {
		($date, $user) = ($1, $2);
	    }
	} elsif (!/^branches: / && !/file .* was initially added on branch/ && !/empty log message/ && !/no_comment/) {
	    $l{$date}{$user}{$file} .= $_;
	}
    } elsif (/Working file: (.*)/) {
	$file = $1;
    }
}

foreach $date (reverse sort keys %l) {
    foreach $user (sort keys %{$l{$date}}) {
	$fuser = $users{$user} || $user;
	print "$date  $fuser\n\n";
	my %inv;
	while (($file, $log) = each %{$l{$date}{$user}}) {
	    $log =~ s/^\s+( \*)?//ms;
	    $log =~ s/\s+$//ms;
	    $log = "\n$log" if $log =~ /^-/;
	    push @{$inv{$log}}, $file;
	}
	foreach $log (keys %inv) {
	    $line = join(', ', @{$inv{$log}}) . ($log !~ /^\(/ && ':') . " $log";
	    print "\t* ", join("\n\t", auto_fill($line, 72)), "\n\n";
	}
    }
}

1;

sub auto_fill {
    my ($line, $col) = @_;
    map {
	my @l;
	my $l = '';
	$_ = "  $_" if /^-/;
	while ($_) {
	    s/^(\s*)(\S*)//;
	    my $m = "$l$1$2";
	    if (length $m > $col) {
		push @l, $l;
		$l = $2;
	    } else {
		$l = $m
	    }
	}
	@l, $l;
    } split("\n", $line);
}

BEGIN {
    %users = (
	      'gc'      => 'Guillaume Cottenceau  <gc at mandrakesoft.com>',
	      'fpons'   => 'Fran�ois Pons  <fpons at mandrakesoft.com>',
	      'pablo'   => 'Pablo Saratxaga  <pablo at mandrakesoft.com>',
	      'damien'  => 'dam\'s  <dams at idm.fr>',
	      'install' => 'DrakX  <install at mandrakesoft.com>',
	      'prigaux' => 'Pixel  <pixel at mandrakesoft.com>',
	      'flepied' => 'Frederic Lepied  <flepied at mandrakesoft.com>',
	      'chmouel' => 'Chmouel Boudjnah  <chmouel at mandrakesoft.com>',
	      'uid526'  => 'dam\'s  <damien at mandrakesoft.com>',
	      'uid533'  => 'Fran�ois Pons  <fpons at mandrakesoft.com>',
	      'uid535'  => 'Guillaume Cottenceau  <gc at mandrakesoft.com>',
	      'uid553'  => 'Pixel  <pixel at mandrakesoft.com>',
	      'tvignaud' =>'Thierry Vignaud  <tvignaud at mandrakesoft.com>',
	      'sbenedict'=>'Stew Benedict  <sbenedict at mandrakesoft.com>',
	      'tkamppeter'=>'Till Kamppeter  <till at mandrakesoft.com>',
	      'yduret'  => 'Yves Duret  <yduret at mandrakesoft.com>',
	      'daouda'  => 'Daouda Lo  <daouda at mandrakesoft.com>',
	      'dchaumette' => 'Damien Chaumette  <dchaumette at mandrakesoft.com>',
	      'cbelisle' =>'Christian Belisle  <cbelisle at mandrakesoft.com>',
	      'warly'   => 'Warly  <warly at mandrakesoft.com>',
	      'jgotti'  => 'Jonathan Gotti  <jgotti at mandrakesoft.com>',
	      'fcrozat' => 'Frederic Crozat  <fcrozat at mandrakesoft.com>',
	      'baudens' => 'David Baudens  <baudens at mandrakesoft.com>',
	      'florin'  => 'Florin Grad  <florin at mandrakesoft.com>',
	      'alafox'  => 'Alice Lafox  <alice at lafox.com.ua>',
	      'alus'    => 'Arkadiusz Lipiec  <alipiec at elka.pw.edu.pl>',
	      'fabman'  => 'Fabian Mandelbaum  <fabman at 2vias.com.ar>',
	     );
}