postgresql/src/tools/pgcvslog

212 lines
4.3 KiB
Text
Raw Normal View History

:
# This utility is used to generate a compact list of changes
# for each release, bjm 2000-02-22
2000-05-31 21:34:02 -04:00
# Usage $0 file
# all branches:
# cvs log -d '>1999-06-14 00:00:00 GMT' . > log
2000-05-31 21:34:02 -04:00
#
2003-08-01 09:48:25 -04:00
# head:
2003-08-01 01:52:44 -04:00
# cvs log -d'>2000-05-29 00:00:00 GMT' -b .
2003-08-01 09:48:25 -04:00
# branch:
# cvs log -d'>2000-05-29 00:00:00 GMT' -rREL7_3_STABLE` .
2000-05-31 21:34:02 -04:00
#
# date range
2003-08-01 01:52:44 -04:00
# cvs log -d'2000-05-08 00:00:00 GMT<2000-05-29 00:00:00 GMT' -b .
2003-08-01 09:48:58 -04:00
#
# Remove TODO and FAQ logs if desired
#
2002-02-18 00:33:13 -05:00
if [ "X$1" == "X-h" ]
then HTML="Y"
shift
else HTML="N"
fi
cat "$@" |
2002-02-18 00:33:13 -05:00
# protect HTML input if in HTML mode
if [ "$HTML" = "Y" ]
then sed -e 's/\&/\&amp;/g' \
-e 's/</\&lt;/g' \
-e 's/>/\&gt;/g' \
-e 's/"/\&quot;/g'
else cat
fi |
2001-01-12 23:58:53 -05:00
# mark each line with a datetime and line number, for sorting and merging
# We don't print anything from the -- or == line and the date:
2002-02-18 00:33:13 -05:00
awk ' BEGIN {html="'"$HTML"'"; lineno = 0;}
2001-01-12 23:58:53 -05:00
# store working directory
$0 ~ /^Working file:/ {workingfile = "/" $3}
2001-01-12 23:58:53 -05:00
($0 ~ /^====*$/ || $0 ~ /^----*$/) \
{
2001-01-12 23:58:53 -05:00
# print blank line to separate entries
if (datetime != "")
{
2002-02-18 00:33:13 -05:00
if (html != "Y")
printf ("%s| %10d|%s\n", datetime, lineno++, "");
printf ("%s| %10d|", datetime, lineno++);
if (html != "Y")
printf ("%s\n", "---");
else printf ("<HR>\n");
}
datetime="";
}
2001-01-12 23:58:53 -05:00
# if we have a saved datetime, print filename, date line, and committer
2002-09-02 13:34:57 -04:00
datetime != "" && $1 != "branches:" {printf ("%s| %10d| %s\n", datetime, lineno++, $0);}
2002-02-18 00:33:13 -05:00
$1 == "date:" \
{
2001-01-12 23:58:53 -05:00
# get entry date
datetime=$2"-"$3
2001-01-12 23:58:53 -05:00
if (workingfile != "")
{
2002-02-18 00:33:13 -05:00
printf ("%s| %10d|", datetime, lineno++);
if (html != "Y")
printf ("%s\n", workingfile);
else printf ("<SMALL><FONT COLOR=\"red\">%s</FONT></SMALL>\n", workingfile);
# output name of committer
# remove semicolon from committers name
2002-02-18 00:33:13 -05:00
gsub("/", "-", $2);
gsub(";", "", $3);
gsub(";", "", $5);
2002-02-18 00:33:13 -05:00
printf ("%s| %10d|", datetime, lineno++);
if (html != "Y")
printf ("%78s\n", $5);
else printf ("<DIV ALIGN=\"right\"><SMALL><FONT COLOR=\"teal\">%s</FONT> <FONT COLOR=\"green\">%s</FONT></SMALL></DIV>\n", $5, $2);
}
}
2001-01-12 23:58:53 -05:00
/* clear working file */
$0 ~ /^====*$/ {workingfile=""}' |
sort | cut -d'|' -f3 | cat |
# collect duplicate narratives
2001-01-12 23:58:53 -05:00
2002-02-18 00:33:13 -05:00
awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
{
2001-01-12 23:58:53 -05:00
# We have a filename, so we look at the previous
# narrative to see if it is new narrative text.
2002-02-18 00:33:13 -05:00
if ($0 ~ /^\// || $0 ~ />\//)
{
2001-01-12 23:58:53 -05:00
# If there are a different number of narrative
# lines, they can not possibly be the same.
if (slot != oldslot)
same = "N";
else
{
same = "Y";
for (i=1; i <= slot; i++)
{
if (oldnarr[i] != narr[i])
{
same = "N";
break;
}
}
}
2001-01-12 23:58:53 -05:00
# dump out the old narrative if it is new
if (same == "N")
{
if (oldslot)
for (i=1; i <= oldslot; i++)
2002-02-18 00:33:13 -05:00
{
print oldnarr[i];
2002-02-18 00:33:13 -05:00
if (html == "Y" &&
oldnarr[i] != "<HR>" &&
oldnarr[i] !~ "^<DIV ")
print "<BR>";
}
2001-01-12 23:58:53 -05:00
# save the current narrative
for (i=1; i <= slot; i++)
oldnarr[i] = narr[i];
oldslot = slot;
}
slot = 0;
2001-01-12 23:58:53 -05:00
# dump out the previous filename
print save_working;
2002-02-18 00:33:13 -05:00
if (html == "Y")
print "<BR>";
2001-01-12 23:58:53 -05:00
# store the current filename for later printing
save_working = $0;
}
2002-02-18 00:33:13 -05:00
else
2001-01-12 23:58:53 -05:00
# we have a narrative line
{
2001-01-12 23:58:53 -05:00
# accumulate narrative
narr[++slot] = $0;
}
}
END {
# If there are a different number of narrative
# lines, they can not possibly be the same.
if (slot != oldslot)
same = "N";
else
{
same = "Y";
for (i=1; i <= slot; i++)
{
if (oldnarr[i] != narr[i])
{
same = "N";
break;
}
}
}
2002-02-18 00:33:13 -05:00
# dump out the old narrative if it is new
if (same == "N")
{
if (oldslot)
for (i=1; i <= oldslot; i++)
{
print oldnarr[i];
if (html == "Y" &&
oldnarr[i] != "<HR>" &&
oldnarr[i] !~ "^<DIV ")
print "<BR>";
}
}
# dump out the last filename
print save_working;
2002-02-18 00:33:13 -05:00
if (html == "Y")
print "<BR>";
2001-01-12 23:58:53 -05:00
# dump out the last narrative
for (i=1; i <= slot; i++)
2002-02-18 00:33:13 -05:00
{
print narr[i];
2002-02-18 00:33:13 -05:00
if (html == "Y" &&
narr[i] != "<HR>" &&
narr[i] !~ "^<DIV ")
2002-02-18 00:33:13 -05:00
print "<BR>";
}
}' |
# add HTML wrapper
if [ "$HTML" = "Y" ]
then echo "<HTML>"
echo "<HEAD>"
echo "<TITLE>CVS</TITLE>"
echo "</HEAD>"
echo "<BODY>"
cat
echo "</BODY>"
echo "</HTML>"
else cat
fi