]> mj.ucw.cz Git - libucw.git/commitdiff
Added a simple utility for generating changelogs.
authorMartin Mares <mj@ucw.cz>
Fri, 3 Oct 2003 16:41:42 +0000 (16:41 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 3 Oct 2003 16:41:42 +0000 (16:41 +0000)
build/cvslog [new file with mode: 0755]

diff --git a/build/cvslog b/build/cvslog
new file mode 100755 (executable)
index 0000000..feded09
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+# Process `cvs log' output to get a resonable changelog
+# (c) 2003 Martin Mares <mj@ucw.cz>
+
+use Digest::MD5;
+use POSIX;
+
+while (<STDIN>) {
+       chomp;
+       /^$/ && 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 ($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} = "";
+               }
+               $files{$id} .= "\t* $file\n";
+               #print "\t$id\n";
+       }
+}
+
+foreach $id (sort keys %date) {
+       print "### ", $date{$id}, "\n\n";
+       print $files{$id}, "\n";
+       print $msg{$id}, "\n";
+}