-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsvnlog2releasenotes.ksh
132 lines (126 loc) · 3.07 KB
/
svnlog2releasenotes.ksh
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#
# script for httpunit release notes formatting
# WF 2008-04-19
# $Header$
#
#
#
# show usage
#
usage() {
echo "usage: svnlog2releasenotes [fromdate]"
echo " get the subversion repository notes and reformat to release notes"
echo " example: rnotes 2007-12 > recent.html"
exit 1
}
#
# get the subversion log
#
getsvnlog() {
svn log https://httpunit.svn.sourceforge.net/svnroot/httpunit > svnlog.txt
}
#
# reformat the subversion log to release notes format
#
reformat() {
cat svnlog.txt | awk -v fromdate="$fromdate" -v todate="$todate" '
BEGIN {
FS="|"
quote="\x22"
amp="\x26"
ignores[i++]="comment added"
ignores[i++]="comments fixed"
ignores[i++]="comment improved"
ignores[i++]="^comment$"
ignores[i++]="^improved$"
ignores[i++]="^keywords$"
ignores[i++]="header"
ignores[i++]="^keywords$"
ignores[i++]="^removed duplicate$"
ignores[i++]="Header added"
ignores[i++]="Copyright year"
ignores[i++]="copyright year"
ignores[i++]="source formatting"
ignores[i++]="source code layout"
ignores[i++]="not for release notes"
}
/^------------------------------------------------------------------------/{
svnindex++; next
}
/^r[0-9]+/ {
match($0,"^r[0-9]+")
rev=substr($0,RSTART+1,RLENGTH-1);
author=$2
date=gsub(" ","",$3)
date=substr($3,1,10)
if (date>=fromdate) {
collect=(1==1)
} else {
collect=(1==0)
}
if (collect) {
# print rev,author,date
}
next
}
{
for (ignore in ignores) {
echo ignores[ignore]
if (match($0,ignores[ignore])) {
collect=(1==0)
}
}
if (collect && length($0)>0){
current=$0
# encode html tags
gsub("<","\\<",current);
gsub(">","\\>",current);
if (text[rev]!="")
text[rev]=text[rev]"<br />"
text[rev]=text[rev]current
}
next
}
END {
print "<ol>"
repositorylink="http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision="
baselink="http://sourceforge.net/tracker/index.php?func=detail"
buglink ="&group_id=6550&atid=106550"
supportlink="&group_id=6550&atid=206550"
patchlink ="&group_id=6550&atid=306550"
for (rev in text) {
current=text[rev]
# look for bug report or patch number - must have 6 digits +
if (match(current,"[0-9][0-9][0-9][0-9][0-9][0-9]+")) {
rs=RSTART
rl=RLENGTH
# get the bug or patch number
linkno=substr(current,RSTART,RLENGTH)
# patch or bug?
if (match(current,"[p|P]atch")) {
postfix=patchlink
} else if (match(current,"SR")) {
postfix=supportlink
} else {
postfix=buglink
}
# replace number with link to sourceforge tracker
link=sprintf("<a href=%s%s&aid=%s%s%s>%s</a>",quote,baselink,linkno,postfix,quote,linkno);
current=substr(current,1,rs-1) link substr(current,rs+rl,length(current))
}
printf(" <li>%s\n (<a href=%s%s%s%s>r%s</a>)\n </li>\n",current,quote,repositorylink,rev,quote,rev);
}
print "</ol>"
}
'
}
#
# check number of command line parameters
#
if [ $# -lt 1 ]
then
usage
fi
fromdate=$1
getsvnlog
reformat