#!/usr/bin/perl -w # Parses tla output to generate a valid # xml changelog use strict; my %months = ( Jan => '01', Feb => '02', Mar => '03', Apr => '04', May => '05', Jun => '06', Jul => '07', Aug => '08', Sep => '09', Oct => '10', Nov => '11', Dec => '12' ); my $date; my $author; my $prev_date=''; my $prev_author=''; while(<>) { if(/Date: [A-z]+ ([A-z]+)[ ]+([0-9]+) ([0-9:]+).*([0-9]{4})/) { $date="$4/$months{$1}/$2 $3"; } elsif(/Creator: .* <(.*)@/) { $author="$1"; } elsif(/^$/) { last; } } die "couldn't find author or date" if(!$date || !$author); print "* $date committed by $author\n" if($date ne $prev_date || $author ne $prev_author); $prev_date=$date; $prev_author=$prev_author; while(<>) { chomp($_); if(/^\* (.*)/ || /\s+(.*)/) { my $var=$1; next if(!$1 || $1 !~ /\S+/); print " o $var\n"; while(<>) { chomp($_); last if(/^$/); print " $_\n"; } } } print "\n";