]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/git2changelog.pl
Require correct Qt version to build bat
[bacula/bacula] / bacula / release / git2changelog.pl
1 #!/usr/bin/perl -w
2 #
3 =head USAGE
4     
5     ./git2changelog.pl Release-3.0.1..Release-3.0.2
6
7  For bweb ReleaseNotes, use
8     FORBWEB=1 ./git2changelog.pl Release-3.0.1..Release-3.0.2
9
10 =cut
11
12 use strict;
13 use POSIX q/strftime/;
14
15 my $d='';
16 my $cur;
17 my %elt;
18 my $last_txt='';
19 my %bugs;
20 my $refs = shift || '';
21 my $for_bweb = $ENV{FORBWEB}?1:0;
22 open(FP, "git log --no-merges --pretty=format:'%at: %s' $refs|") or die "Can't run git log $!";
23 while (my $l = <FP>) {
24
25     # remove non useful messages
26     next if ($l =~ /(tweak|typo|cleanup|regress:|again|.gitignore|fix compilation|technotes)/ixs);
27     next if ($l =~ /update (version|technotes|kernstodo|projects|releasenotes|version|home|release|todo|notes|changelog|tpl|configure)/i);
28
29     next if ($l =~ /bacula-web:/);
30
31     if ($for_bweb) {
32         next if ($l !~ /bweb/ixs);
33         $l =~ s/bweb: *//ig;
34     } else {
35         next if ($l =~ /bweb:/ixs);
36     }
37
38     # keep list of fixed bugs
39     if ($l =~ /#(\d+)/) {
40         $bugs{$1}=1;
41     }
42
43     # remove old commit format
44     $l =~ s/^(\d+): (kes|ebl)  /$1: /;
45
46     if ($l =~ /(\d+): (.+)/) {
47         # use date as 01Jan70
48         my $dnow = strftime('%d%b%y', localtime($1));
49         my $cur = strftime('%Y%m%d', localtime($1));
50         my $txt = $2;
51
52         # avoid identical multiple commit message
53         next if ($last_txt eq $txt);
54         $last_txt = $txt;
55
56         # We format the string on 79 caracters
57         $txt =~ s/\s\s+/ /g;
58         $txt =~ s/.{70,77} /$&\n  /g;
59
60         # if we are the same day, just add entry
61         if ($dnow ne $d) {
62             $d = $dnow;
63             if (!exists $elt{$cur}) {
64                 push @{$elt{$cur}}, "\n\n$dnow";
65             }
66         }
67         push @{$elt{$cur}},  " - $txt";
68
69     } else {
70         print STDERR "invalid format: $l\n";
71     }
72 }
73
74 close(FP);
75
76 foreach my $d (sort {$b <=> $a} keys %elt) {
77     print join("\n", @{$elt{$d}});
78 }
79
80 print "\n\nBug fixes\n";
81 print join(" ", sort keys %bugs), "\n";