]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/git2changelog.pl
Fix ActionOnPurge with a relabel command
[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 =cut
8
9 use strict;
10 use Time::CTime;
11
12 my $d='';
13 my $last_txt='';
14 my %bugs;
15 my $refs = shift || '';
16 open(FP, "git log --no-merges --pretty=format:'%ct: %s' $refs|") or die "Can't run git log $!";
17 while (my $l = <FP>) {
18
19     # remove non useful messages
20     next if ($l =~ /(tweak|typo|cleanup|bweb:|regress:|again|.gitignore|fix compilation|technotes)/ixs);
21     next if ($l =~ /update (version|technotes|kernstodo|projects|releasenotes|version|home|release|todo|notes|changelog)/i);
22
23     # keep list of fixed bugs
24     if ($l =~ /#(\d+)/) {
25         $bugs{$1}=1;
26     }
27
28     # remove old commit format
29     $l =~ s/^(\d+): (kes|ebl)  /$1: /;
30
31     if ($l =~ /(\d+): (.+)/) {
32         # use date as 01Jan70
33         my $dnow = strftime('%d%b%y', localtime($1));
34         my $txt = $2;
35
36         # avoid identical multiple commit message
37         next if ($last_txt eq $txt);
38         $last_txt = $txt;
39
40         # We format the string on 79 caracters
41         $txt =~ s/\s\s+/ /g;
42         $txt =~ s/.{70,77} /$&\n  /g;
43
44         # if we are the same day, just add entry
45         if ($dnow ne $d) {
46             print "\n$dnow\n";
47             $d = $dnow;
48         }
49         print "- $txt\n";
50
51     } else {
52         print STDERR "invalid format: $l\n";
53     }
54 }
55
56 close(FP);
57
58 print "\nBug fixes\n";
59 print join(" ", sort keys %bugs), "\n";