• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env perl
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22###########################################################################
23
24# git log --pretty=fuller --no-color --date=short --decorate=full
25
26my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
27             'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
28
29sub nicedate {
30    my ($date)=$_;
31
32    if($date =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) {
33        return sprintf("%d %s %4d", $3, $mname[$2-1], $1);
34    }
35    return $date;
36}
37
38print
39'                                  _   _ ____  _
40                              ___| | | |  _ \| |
41                             / __| | | | |_) | |
42                            | (__| |_| |  _ <| |___
43                             \___|\___/|_| \_\_____|
44
45                                  Changelog
46';
47
48my $line;
49my $tag;
50while(<STDIN>) {
51    my $l = $_;
52
53    if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
54        $co = $1;
55        my $ref = $2;
56        if ($ref =~ /refs\/tags\/curl-([0-9_]*)/) {
57            $tag = $1;
58            $tag =~ tr/_/./;
59        }
60    }
61    elsif($l =~ /^Author: *(.*) +</) {
62        $a = $1;
63    }
64    elsif($l =~ /^Commit: *(.*) +</) {
65        $c = $1;
66    }
67    elsif($l =~ /^CommitDate: (.*)/) {
68        $date = nicedate($1);
69    }
70    elsif($l =~ /^(    )(.*)/) {
71        my $extra;
72        if ($tag) {
73            # Version entries have a special format
74            print "\nVersion " . $tag." ($date)\n";
75            $oldc = "";
76            $tag = "";
77        }
78        if($a ne $c) {
79            $extra=sprintf("\n- [%s brought this change]\n\n  ", $a);
80        }
81        else {
82            $extra="\n- ";
83        }
84        if($co ne $oldco) {
85            if($c ne $oldc) {
86                print "\n$c ($date)$extra";
87            }
88            else {
89                print "$extra";
90            }
91            $line =0;
92        }
93
94        $oldco = $co;
95        $oldc = $c;
96        $olddate = $date;
97        if($line++) {
98            print "  ";
99        }
100        print $2."\n";
101    }
102}
103