1#!/usr/bin/perl 2 3# git log --pretty=fuller --no-color --date=short --decorate=full 4 5my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 6 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); 7 8sub nicedate { 9 my ($date)=$_; 10 11 if($date =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) { 12 return sprintf("%d %s %4d", $3, $mname[$2-1], $1); 13 } 14 return $date; 15} 16 17print 18' Changelog for the libssh2 project. Generated with git2news.pl 19'; 20 21my $line; 22my $tag; 23while(<STDIN>) { 24 my $l = $_; 25 26 if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) { 27 $co = $1; 28 my $ref = $2; 29 if ($ref =~ /refs\/tags\/(libssh2-|VERSION\.)([0-9._]*)/) { 30 $tag = $2; 31 } else { 32 $tag = ''; 33 } 34 } 35 elsif($l =~ /^Author: *(.*) +</) { 36 $a = $1; 37 } 38 elsif($l =~ /^Commit: *(.*) +</) { 39 $c = $1; 40 } 41 elsif($l =~ /^CommitDate: (.*)/) { 42 $date = nicedate($1); 43 } 44 elsif($l =~ /^( )(.*)/) { 45 my $extra; 46 if ($tag) { 47 # Version entries have a special format 48 print "\nVersion " . $tag." ($date)\n"; 49 $oldc = ""; 50 $tag = ""; 51 } 52 if($a ne $c) { 53 $extra=sprintf("\n- [%s brought this change]\n\n ", $a); 54 } 55 else { 56 $extra="\n- "; 57 } 58 if($co ne $oldco) { 59 if($c ne $oldc) { 60 print "\n$c ($date)$extra"; 61 } 62 else { 63 print "$extra"; 64 } 65 $line =0; 66 } 67 68 $oldco = $co; 69 $oldc = $c; 70 $olddate = $date; 71 if($line++) { 72 print " "; 73 } 74 print $2."\n"; 75 } 76} 77