forked from Flumotion/flumotion-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlog2ChangeLog
executable file
·91 lines (90 loc) · 1.49 KB
/
gitlog2ChangeLog
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
#!/usr/bin/awk -f
function clean_environment()
{
header = ""
commit_msg = ""
backport = ""
reviewed = ""
release_tag = ""
file_list = ""
in_commit = 0
in_description = 0
in_refs = 0
in_files = 0
}
function print_commit()
{
if (release_tag)
print release_tag
if (header)
print header
if (reviewed)
print reviewed
if (backport)
print backport
if (file_list)
print file_list
if (commit_msg)
print commit_msg
}
BEGIN {
clean_environment()
}
/^commit:/ {
print_commit()
clean_environment()
in_commit = 1
next
}
/^description:/ {
in_description = 1
in_commit = 0
next
}
/^refs:/ {
in_refs = 1
in_description = 0
}
/^files:/ {
in_refs = 0
in_files = 1
next
}
in_commit == 1 {
header = sprintf("%s\n", $0)
next
}
in_description == 1 {
if (/^[Bb]ackport/) {
backport = sprintf("\t%s", $0)
next
}
if (/^[Rr]eviewed by/) {
reviewed = sprintf("\t%s", $0)
next
}
if (commit_msg)
commit_msg = sprintf("%s\t%s\n", commit_msg, $0)
else
commit_msg = sprintf("\t%s\n", $0)
next
}
in_refs == 1 {
match($0, /[0-9]+\.[0-9]+\.[0-9]+/)
if (RSTART)
release_tag = sprintf("=== release %s ===\n", substr($0, RSTART, RLENGTH))
}
in_files == 1 {
if ($0 && ! /ChangeLog/)
if (!file_list)
if (reviewed || backport)
file_list = sprintf("\n\t* %s:", $0)
else
file_list = sprintf("\t* %s:", $0)
else
file_list = sprintf("%s\n\t* %s:", file_list, $0)
next
}
END {
print_commit()
}