diff --git a/src/tools/pgcvslog b/src/tools/pgcvslog
index 6a4ef02e04..9b8ead1c4e 100755
--- a/src/tools/pgcvslog
+++ b/src/tools/pgcvslog
@@ -19,12 +19,27 @@
# find . -name CVS -type d -exec rm '{}/Entries.Static' \;
#
+if [ "X$1" == "X-h" ]
+then HTML="Y"
+ shift
+else HTML="N"
+fi
+
cat "$@" |
+# protect HTML input if in HTML mode
+if [ "$HTML" = "Y" ]
+then sed -e 's/\&/\&/g' \
+ -e 's/\</g' \
+ -e 's/>/\>/g' \
+ -e 's/"/\"/g'
+else cat
+fi |
+
# 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:
-awk '
+awk ' BEGIN {html="'"$HTML"'"; lineno = 0;}
# store working directory
$0 ~ /^Working file:/ {workingfile = "/" $3}
@@ -33,27 +48,39 @@ awk '
# print blank line to separate entries
if (datetime != "")
{
- printf ("%s| %10d|%s\n", datetime, NR, "");
- printf ("%s| %10d|%s\n", datetime, NR, "---");
+ if (html != "Y")
+ printf ("%s| %10d|%s\n", datetime, lineno++, "");
+ printf ("%s| %10d|", datetime, lineno++);
+ if (html != "Y")
+ printf ("%s\n", "---");
+ else printf ("
\n");
}
datetime="";
}
# if we have a saved datetime, print filename, date line, and committer
- datetime != "" {printf ("%s| %10d| %s\n", datetime, NR, $0);}
+ datetime != "" {printf ("%s| %10d| %s\n", datetime, lineno++, $0);}
- $1 == "date:" \
+ $1 == "date:" \
{
# get entry date
datetime=$2"-"$3
if (workingfile != "")
{
- # remove semicolon from committers name
- gsub(";", "", $5);
- printf ("%s| %10d|%s\n", datetime, NR-2, workingfile);
- printf ("%s| %10d|%s\n", datetime, NR-1, $0);
+ printf ("%s| %10d|", datetime, lineno++);
+ if (html != "Y")
+ printf ("%s\n", workingfile);
+ else printf ("%s\n", workingfile);
+
# output name of committer
- printf ("%s| %10d| %70s\n", datetime, NR+1, $5);
+ # remove semicolon from committers name
+ gsub("/", "-", $2);
+ gsub(";", "", $3);
+ gsub(";", "", $5);
+ printf ("%s| %10d|", datetime, lineno++);
+ if (html != "Y")
+ printf ("%78s\n", $5);
+ else printf ("%s %s
\n", $5, $2);
}
}
@@ -64,12 +91,11 @@ sort | cut -d'|' -f3 | cat |
# collect duplicate narratives
-awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
+awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
{
# We have a filename, so we look at the previous
# narrative to see if it is new narrative text.
- #
- if ($0 ~ /^\//)
+ if ($0 ~ /^\// || $0 ~ />\//)
{
# If there are a different number of narrative
# lines, they can not possibly be the same.
@@ -93,7 +119,13 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
{
if (oldslot)
for (i=1; i <= oldslot; i++)
+ {
print oldnarr[i];
+ if (html == "Y" &&
+ oldnarr[i] != "
" &&
+ oldnarr[i] !~ "^";
+ }
# save the current narrative
for (i=1; i <= slot; i++)
@@ -104,12 +136,14 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
# dump out the previous filename
print save_working;
+ if (html == "Y")
+ print "
";
# store the current filename for later printing
save_working = $0;
}
+ else
# we have a narrative line
- else if ($1 != "date:")
{
# accumulate narrative
narr[++slot] = $0;
@@ -117,9 +151,31 @@ awk ' BEGIN { slot = 0; oldslot=0; save_working = ""; }
}
END {
# dump out the last filename
+
print save_working;
+ if (html == "Y")
+ print "
";
# dump out the last narrative
for (i=1; i <= slot; i++)
+ {
print narr[i];
- }'
+ if (html == "Y" &&
+ oldnarr[i] != "
" &&
+ oldnarr[i] !~ "^
";
+ }
+ }' |
+
+# add HTML wrapper
+if [ "$HTML" = "Y" ]
+then echo ""
+ echo ""
+ echo "
CVS"
+ echo ""
+ echo ""
+ cat
+ echo ""
+ echo ""
+else cat
+fi