forked from UECIDE/UECIDE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mklog
executable file
·106 lines (79 loc) · 1.93 KB
/
mklog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/perl
use strict;
use Data::Dumper;
my @order = ("HEAD");
my $versions;
#push(@{$versions->{"HEAD"}}, "HEAD");
print "Changelog\n";
print "=========\n\n";
my $last = "HEAD";
my $tags = `git tag -l --sort=-v:refname`;
open(TAGS, "git tag -l --sort=-v:refname |");
while (my $tag = <TAGS>) {
chomp($tag);
my $cleantag = $tag;
if ($cleantag =~ /^([^a-z\-]*)[a-z\-]+/) {
$cleantag = $1;
}
if ($cleantag ne $last) {
push(@order, $cleantag);
$last = $cleantag;
}
push(@{$versions->{$cleantag}}, $tag);
}
my @majorVersions;
shift(@order);
unshift(@{$versions->{$order[0]}}, "HEAD");
my $slice = 0;
my $slices = @order;
my $wanted = shift;
my $major;
my $minor;
while ($slice < $slices) {
my $start = $versions->{$order[$slice]}->[0];
my $end = $versions->{$order[$slice+1]}->[0];
print $order[$slice] . "\n";
for (my $i = 0; $i < length($order[$slice]); $i++) {
print "-";
}
print "\n";
print "\n";
open(LOG, "git log $start...$end --oneline --pretty=format:\"%s\" --date=short |");
while (my $log = <LOG>) {
chomp($log);
if ($log =~ /^Released /) {
next;
}
if ($log =~ /\*/) {
my @ll = split(/\*/, $log);
for my $line (@ll) {
$line =~ s/^\s+|\s+$//g;
if ($line ne "") {
print "* $line\n";
}
}
} else {
print "* $log\n";
}
}
print "\n\n";
$slice++;
}
#TAGS=$(git tag -l --sort=-v:refname)
#CTAG=""
#LTAG=""
#echo "<h1>Changelog</h1>"
#echo
#for TAG in $TAGS; do
# MTAG=$(echo $TAG | cut -f1 -d'-')
# if [ "x$MTAG" != "x$LTAG" ]; then
# echo ""
# echo ""
# echo "$CTAG"
# echo "----"
# echo ""
# LTAG=$MTAG
# fi
# git log $CTAG...$TAG --oneline --pretty=format:"* %s" --date=short
# CTAG=$TAG
#done