Skip to content
Newer
Older
100755 83 lines (73 sloc) 1.86 KB
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
1 #!/usr/bin/perl
2
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
bagder authored Jun 21, 2010
3 # git log --pretty=fuller --no-color --date=short --decorate=full
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
4
5 my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
6 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
7
8 sub 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
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
17 print
18 ' _ _ ____ _
19 ___| | | | _ \| |
20 / __| | | | |_) | |
21 | (__| |_| | _ <| |___
22 \___|\___/|_| \_\_____|
23
24 Changelog
25 ';
26
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
27 my $line;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
28 my $tag;
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
29 while(<STDIN>) {
30 my $l = $_;
31
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
32 if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
33 $co = $1;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
34 my $ref = $2;
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
bagder authored Jun 21, 2010
35 if ($ref =~ /refs\/tags\/curl-([0-9_]*)/) {
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
36 $tag = $1;
ed03643 @yangtse removed trailing whitespace
yangtse authored Dec 30, 2011
37 $tag =~ tr/_/./;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored Jun 21, 2010
38 } else {
39 $tag = '';
40 }
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
41 }
42 elsif($l =~ /^Author: *(.*) +</) {
43 $a = $1;
44 }
45 elsif($l =~ /^Commit: *(.*) +</) {
46 $c = $1;
47 }
48 elsif($l =~ /^CommitDate: (.*)/) {
49 $date = nicedate($1);
50 }
51 elsif($l =~ /^( )(.*)/) {
52 my $extra;
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
bagder authored Jun 21, 2010
53 if ($tag) {
54 # Version entries have a special format
55 print "\nVersion " . $tag." ($date)\n";
56 $oldc = "";
57 }
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
bagder authored Jun 19, 2010
58 if($a ne $c) {
59 $extra=sprintf("\n- [%s brought this change]\n\n ", $a);
60 }
61 else {
62 $extra="\n- ";
63 }
64 if($co ne $oldco) {
65 if($c ne $oldc) {
66 print "\n$c ($date)$extra";
67 }
68 else {
69 print "$extra";
70 }
71 $line =0;
72 }
73
74 $oldco = $co;
75 $oldc = $c;
76 $olddate = $date;
77 if($line++) {
78 print " ";
79 }
80 print $2."\n";
81 }
82 }
Something went wrong with that request. Please try again.