Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 82 lines (72 sloc) 1.888 kB
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
1 #!/usr/bin/perl
2
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
authored
3 # git log --pretty=fuller --no-color --date=short --decorate=full
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
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
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
authored
27 my $line;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored
28 my $tag;
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
29 while(<STDIN>) {
30 my $l = $_;
31
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored
32 if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
33 $co = $1;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored
34 my $ref = $2;
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
authored
35 if ($ref =~ /refs\/tags\/curl-([0-9_]*)/) {
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored
36 $tag = $1;
ed03643 @yangtse removed trailing whitespace
yangtse authored
37 $tag =~ tr/_/./;
8e7ec79 @dfandrich Make the output of log2changes.pl even more closely match CHANGES
dfandrich authored
38 }
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
39 }
40 elsif($l =~ /^Author: *(.*) +</) {
41 $a = $1;
42 }
43 elsif($l =~ /^Commit: *(.*) +</) {
44 $c = $1;
45 }
46 elsif($l =~ /^CommitDate: (.*)/) {
47 $date = nicedate($1);
48 }
49 elsif($l =~ /^( )(.*)/) {
50 my $extra;
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
authored
51 if ($tag) {
52 # Version entries have a special format
53 print "\nVersion " . $tag." ($date)\n";
54 $oldc = "";
d2fc8b4 @bagder log2changes.pl: fix the Version output
authored
55 $tag = "";
d838322 @bagder log2changes: correct command line, fix tag usage, change Version output
authored
56 }
bd5d478 @bagder log2changes: first version of the git log to CHANGES conversion script
authored
57 if($a ne $c) {
58 $extra=sprintf("\n- [%s brought this change]\n\n ", $a);
59 }
60 else {
61 $extra="\n- ";
62 }
63 if($co ne $oldco) {
64 if($c ne $oldc) {
65 print "\n$c ($date)$extra";
66 }
67 else {
68 print "$extra";
69 }
70 $line =0;
71 }
72
73 $oldco = $co;
74 $oldc = $c;
75 $olddate = $date;
76 if($line++) {
77 print " ";
78 }
79 print $2."\n";
80 }
81 }
Something went wrong with that request. Please try again.