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 c-ares project. Generated with git2changes.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\/c[-]*ares-([0-9._]*)/) { 30 $tag = $1; 31 $tag =~ s/_/./g; 32 } else { 33 $tag = ''; 34 } 35 } 36 elsif($l =~ /^Author: *(.*) +</) { 37 $a = $1; 38 } 39 elsif($l =~ /^Commit: *(.*) +</) { 40 $c = $1; 41 } 42 elsif($l =~ /^CommitDate: (.*)/) { 43 $date = nicedate($1); 44 } 45 elsif($l =~ /^( )(.*)/) { 46 my $extra; 47 if ($tag) { 48 # Version entries have a special format 49 print "\nVersion " . $tag." ($date)\n"; 50 $oldc = ""; 51 $tag = ""; 52 } 53 if($a ne $c) { 54 $extra=sprintf("\n- [%s brought this change]\n\n ", $a); 55 } 56 else { 57 $extra="\n- "; 58 } 59 if($co ne $oldco) { 60 if($c ne $oldc) { 61 print "\n$c ($date)$extra"; 62 } 63 else { 64 print "$extra"; 65 } 66 $line =0; 67 } 68 69 $oldco = $co; 70 $oldc = $c; 71 $olddate = $date; 72 if($line++) { 73 print " "; 74 } 75 print $2."\n"; 76 } 77} 78