#! /usr/bin/perl -w
#
# $Id$
#
# Print the output of svn2cl by descending date.
#

@chunks = ();

while(<STDIN>) {
    chomp;
    if ($_ =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/) {

        if (defined $current_chunk && $current_chunk =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/) {
            push @chunks, $current_chunk;
        }

        $current_chunk = $_;
    } elsif ($current_chunk =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/) {
        $current_chunk = "$current_chunk\n$_";
    } 
}

if ($current_chunk =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/) {
    push @chunks, $current_chunk;
}

@sorted_chunks = sort @chunks;

for ($i = $#sorted_chunks; $i >= 0; --$i) {
    print "$sorted_chunks[$i]\n";
}
