11#! /bin/sh
22
3- # $PostgreSQL: pgsql/src/tools/pgcvslog,v 1.33 2007/01/31 22:17 :03 momjian Exp $
3+ # $PostgreSQL: pgsql/src/tools/pgcvslog,v 1.34 2007/10/01 02:59 :03 momjian Exp $
44
55# This utility is used to generate a compact list of changes
66# for each release, bjm 2000-02-22
77
8- # Usage $0 file
8+ # Usage: pgcvslog [-h]
9+ # -h is HTML output
910
1011# All branches:
1112# cvs log -d'>1999-06-14 00:00:00 GMT' . > log
@@ -49,6 +50,7 @@ elsecat
4950fi |
5051
5152# mark each line with a datetime and line number, for sorting and merging
53+ # we are just pre-processing the file at this point
5254# We don't print anything from the -- or == line and the date:
5355
5456awk' BEGIN{html="' " $HTML " ' "; lineno = 0;}
@@ -87,8 +89,8 @@ awk 'BEGIN{html="'"$HTML"'"; lineno = 0;}
8789{
8890printf ("%s| %10d|", datetime, lineno++);
8991if (html != "Y")
90- printf ("%s\n", workingfile);
91- elseprintf ("<SMALL><FONT COLOR=\"red\">%s</FONT></SMALL>\n", workingfile);
92+ printf ("%s%s \n", workingfile, back_branch );
93+ elseprintf ("<SMALL><FONT COLOR=\"red\">%s%s </FONT></SMALL>\n", workingfile, back_branch );
9294
9395# output name of committer
9496# remove semicolon from committers name
@@ -102,27 +104,39 @@ awk 'BEGIN{html="'"$HTML"'"; lineno = 0;}
102104}
103105}
104106
107+ # mark back branches
108+ $1 == "revision" \
109+ {
110+ if ($2 ~ /\..*\./ && del == "Y")
111+ back_branch=" <back-patch>"
112+ elseback_branch = ""
113+ }
114+
105115/* clear working file */
106116$0 ~ /^====*$/{workingfile=""}' |
107117
108118sort| cut -d' |' -f3|
109119
110120# collect duplicate narratives
121+ # print file names as we get them, then print narrative when a new
122+ # narrative appears
123+ # have to save two narratives to compare them
111124
112- awk' BEGIN { slot = 0; oldslot=0; save_working = ""; html="' " $HTML " ' "}
125+ awk' BEGIN { narr_slot = 0; oldnarr_slot=0; save_working = "";
126+ html="' " $HTML " ' "}
113127{
114128# We have a filename, so we look at the previous
115129# narrative to see if it is new narrative text.
116- if ($0 ~/^\// || $0 ~/>\// )
130+ if ($0 ~"^/" || $0 ~">/" )
117131{
118132# If there are a different number of narrative
119- # lines, theycan not possibly be the same.
120- if (slot !=oldslot )
133+ # lines, theycannot possibly be the same.
134+ if (narr_slot !=oldnarr_slot )
121135same = "N";
122136else
123137{
124138same = "Y";
125- for (i=1; i <=slot ; i++)
139+ for (i=1; i <=narr_slot ; i++)
126140{
127141if (oldnarr[i] != narr[i])
128142{
@@ -135,8 +149,8 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
135149# dump out the old narrative if it is new
136150if (same == "N")
137151{
138- if (oldslot )
139- for (i=1; i <=oldslot ; i++)
152+ if (oldnarr_slot )
153+ for (i=1; i <=oldnarr_slot ; i++)
140154{
141155print oldnarr[i];
142156if (html == "Y" &&
@@ -146,14 +160,15 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
146160}
147161
148162# save the current narrative
149- for (i=1; i <=slot ; i++)
163+ for (i=1; i <=narr_slot ; i++)
150164oldnarr[i] = narr[i];
151- oldslot =slot ;
165+ oldnarr_slot =narr_slot ;
152166}
153- slot = 0;
167+ narr_slot = 0;
154168
155169# dump out the previous filename
156170print save_working;
171+
157172if (html == "Y")
158173print "<BR>";
159174
@@ -164,57 +179,58 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
164179# we have a narrative line
165180{
166181# accumulate narrative
167- narr[++slot ] = $0;
182+ narr[++narr_slot ] = $0;
168183}
169184}
170- END{
171- # If there are a different number of narrative
172- # lines, they can not possibly be the same.
173- if (slot != oldslot)
174- same = "N";
175- else
185+ END \
186+ {
187+ # If there are a different number of narrative
188+ # lines, they can not possibly be the same.
189+ if (narr_slot != oldnarr_slot)
190+ same = "N";
191+ else
192+ {
193+ same = "Y";
194+ for (i=1; i <= narr_slot; i++)
176195{
177- same = "Y";
178- for (i=1; i <= slot; i++)
196+ if (oldnarr[i] != narr[i])
179197{
180- if (oldnarr[i] != narr[i])
181- {
182- same = "N";
183- break;
184- }
198+ same = "N";
199+ break;
185200}
186201}
202+ }
187203
188- # dump out the old narrative if it is new
189- if (same == "N")
190- {
191- if (oldslot )
192- for (i=1; i <=oldslot ; i++)
193- {
194- print oldnarr[i];
195- if (html == "Y" &&
196- oldnarr[i] != "<HR>" &&
197- oldnarr[i] !~ "^<DIV ")
198- print "<BR>";
199- }
200- }
204+ # dump out the old narrative if it is new
205+ if (same == "N")
206+ {
207+ if (oldnarr_slot )
208+ for (i=1; i <=oldnarr_slot ; i++)
209+ {
210+ print oldnarr[i];
211+ if (html == "Y" &&
212+ oldnarr[i] != "<HR>" &&
213+ oldnarr[i] !~ "^<DIV ")
214+ print "<BR>";
215+ }
216+ }
201217
202- # dump out the last filename
203- print save_working;
218+ # dump out the last filename
219+ print save_working;
204220
205- if (html == "Y")
206- print "<BR>";
221+ if (html == "Y")
222+ print "<BR>";
207223
208- # dump out the last narrative
209- for (i=1; i <=slot ; i++)
210- {
211- print narr[i];
212- if (html == "Y" &&
213- narr[i] != "<HR>" &&
214- narr[i] !~ "^<DIV ")
215- print "<BR>";
216- }
217- }' |
224+ # dump out the last narrative
225+ for (i=1; i <=narr_slot ; i++)
226+ {
227+ print narr[i];
228+ if (html == "Y" &&
229+ narr[i] != "<HR>" &&
230+ narr[i] !~ "^<DIV ")
231+ print "<BR>";
232+ }
233+ }' |
218234
219235# add HTML wrapper
220236if [" $HTML " = " Y" ]