19
19
# find . -name CVS -type d -exec rm '{}/Entries.Static' \;
20
20
#
21
21
22
+ if [ "X$1" == "X-h" ]
23
+ then HTML="Y"
24
+ shift
25
+ else HTML="N"
26
+ fi
27
+
22
28
cat "$@" |
23
29
30
+ # protect HTML input if in HTML mode
31
+ if [ "$HTML" = "Y" ]
32
+ then sed -e 's/\&/\&/g' \
33
+ -e 's/</\</g' \
34
+ -e 's/>/\>/g' \
35
+ -e 's/"/\"/g'
36
+ else cat
37
+ fi |
38
+
24
39
# mark each line with a datetime and line number, for sorting and merging
25
40
# We don't print anything from the -- or == line and the date:
26
41
27
- awk '
42
+ awk ' BEGIN {html="'"$HTML"'"; lineno = 0;}
28
43
# store working directory
29
44
$0 ~ /^Working file:/ {workingfile = "/" $3}
30
45
@@ -33,27 +48,39 @@ awk '
33
48
# print blank line to separate entries
34
49
if (datetime != "")
35
50
{
36
- printf ("%s| %10d|%s\n", datetime, NR, "");
37
- printf ("%s| %10d|%s\n", datetime, NR, "---");
51
+ if (html != "Y")
52
+ printf ("%s| %10d|%s\n", datetime, lineno++, "");
53
+ printf ("%s| %10d|", datetime, lineno++);
54
+ if (html != "Y")
55
+ printf ("%s\n", "---");
56
+ else printf ("<HR>\n");
38
57
}
39
58
datetime="";
40
59
}
41
60
42
61
# if we have a saved datetime, print filename, date line, and committer
43
- datetime != "" {printf ("%s| %10d| %s\n", datetime, NR , $0);}
62
+ datetime != "" {printf ("%s| %10d| %s\n", datetime, lineno++ , $0);}
44
63
45
- $1 == "date:" \
64
+ $1 == "date:" \
46
65
{
47
66
# get entry date
48
67
datetime=$2"-"$3
49
68
if (workingfile != "")
50
69
{
70
+ printf ("%s| %10d|", datetime, lineno++);
71
+ if (html != "Y")
72
+ printf ("%s\n", workingfile);
73
+ else printf ("<SMALL><FONT COLOR=\"red\">%s</FONT></SMALL>\n", workingfile);
74
+
75
+ # output name of committer
51
76
# remove semicolon from committers name
77
+ gsub("/", "-", $2);
78
+ gsub(";", "", $3);
52
79
gsub(";", "", $5);
53
- printf ("%s| %10d|%s\n ", datetime, NR-2, workingfile );
54
- printf ("%s| %10d|%s\n", datetime, NR-1, $0);
55
- # output name of committer
56
- printf ("%s| %10d| %70s \n", datetime, NR+1, $5 );
80
+ printf ("%s| %10d|", datetime, lineno++ );
81
+ if (html != "Y")
82
+ printf ("%78s\n", $5);
83
+ else printf ("<DIV ALIGN=\"right\"><SMALL><FONT COLOR=\"teal\">%s</FONT> <FONT COLOR=\"green\">%s</FONT></SMALL></DIV> \n", $5, $2 );
57
84
}
58
85
}
59
86
@@ -64,12 +91,11 @@ sort | cut -d'|' -f3 | cat |
64
91
65
92
# collect duplicate narratives
66
93
67
- awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
94
+ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'" }
68
95
{
69
96
# We have a filename, so we look at the previous
70
97
# narrative to see if it is new narrative text.
71
- #
72
- if ($0 ~ /^\//)
98
+ if ($0 ~ /^\// || $0 ~ />\//)
73
99
{
74
100
# If there are a different number of narrative
75
101
# lines, they can not possibly be the same.
@@ -93,7 +119,13 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
93
119
{
94
120
if (oldslot)
95
121
for (i=1; i <= oldslot; i++)
122
+ {
96
123
print oldnarr[i];
124
+ if (html == "Y" &&
125
+ oldnarr[i] != "<HR>" &&
126
+ oldnarr[i] !~ "^<DIV ")
127
+ print "<BR>";
128
+ }
97
129
98
130
# save the current narrative
99
131
for (i=1; i <= slot; i++)
@@ -104,22 +136,46 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
104
136
105
137
# dump out the previous filename
106
138
print save_working;
139
+ if (html == "Y")
140
+ print "<BR>";
107
141
108
142
# store the current filename for later printing
109
143
save_working = $0;
110
144
}
145
+ else
111
146
# we have a narrative line
112
- else if ($1 != "date:")
113
147
{
114
148
# accumulate narrative
115
149
narr[++slot] = $0;
116
150
}
117
151
}
118
152
END {
119
153
# dump out the last filename
154
+
120
155
print save_working;
156
+ if (html == "Y")
157
+ print "<BR>";
121
158
122
159
# dump out the last narrative
123
160
for (i=1; i <= slot; i++)
161
+ {
124
162
print narr[i];
125
- }'
163
+ if (html == "Y" &&
164
+ oldnarr[i] != "<HR>" &&
165
+ oldnarr[i] !~ "^<DIV ")
166
+ print "<BR>";
167
+ }
168
+ }' |
169
+
170
+ # add HTML wrapper
171
+ if [ "$HTML" = "Y" ]
172
+ then echo "<HTML>"
173
+ echo "<HEAD>"
174
+ echo "<TITLE>CVS</TITLE>"
175
+ echo "</HEAD>"
176
+ echo "<BODY>"
177
+ cat
178
+ echo "</BODY>"
179
+ echo "</HTML>"
180
+ else cat
181
+ fi
0 commit comments