diff options
author | Martin Mares <mj@ucw.cz> | 2004-05-31 22:16:54 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2004-05-31 22:16:54 +0000 |
commit | 3810eccf6bc5af413d883fd298d59e0d7bdb96ea (patch) | |
tree | 2ad05a7b2e6643ed734b4f3bb39105d4dcdc47f5 | |
parent | ea0ac8f69aec4eff8109eb3d74cc0ca5a330fa58 (diff) |
Added a simple utility for converting CVS log messages to a reasonable
changelog format.
-rwxr-xr-x | tools/cvslog | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/cvslog b/tools/cvslog new file mode 100755 index 00000000..41abbc2e --- /dev/null +++ b/tools/cvslog @@ -0,0 +1,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"; +} |