Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e77df38

Browse files
committed
Add pgcvslog '-d' capability to allow stripping of commit messages that
have back branch activity. This will be useful for creating release notes for major releases.
1 parent 3a38ea2 commit e77df38

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

src/tools/pgcvslog

+64-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/bin/sh
22

3-
# $PostgreSQL: pgsql/src/tools/pgcvslog,v 1.36 2007/10/01 13:04:55 momjian Exp $
3+
# $PostgreSQL: pgsql/src/tools/pgcvslog,v 1.37 2007/10/05 16:42:32 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: pgcvslog [-h]
8+
# Usage: pgcvslog [-d] [-h]
9+
# -d delete commits that include back branches
910
# -h is HTML output
1011

12+
# This program basically takes a cvs log, groups it by commit timestamp
13+
# and line number, then compares adjacent messages. If they have the same
14+
# commit message, they are assumed to be part of the same commit and
15+
# appear as one commit message with multiple file names
16+
1117
# All branches:
1218
# cvs log -d'>1999-06-14 00:00:00 GMT' . > log
1319
#
@@ -32,10 +38,26 @@
3238
# /cvsroot/pgsql/doc/src/FAQ/FAQ.html
3339
#
3440

41+
HTML="N"
42+
DEL="N"
3543
if [ "X$1" = "X-h" ]
3644
then HTML="Y"
3745
shift
38-
else HTML="N"
46+
fi
47+
48+
if [ "X$1" = "X-d" ]
49+
then DEL="Y"
50+
shift
51+
fi
52+
53+
if [ "X$1" = "X-h" ]
54+
then HTML="Y"
55+
shift
56+
fi
57+
58+
if [ "$HTML" = "Y" -a "$DEL" = "Y" ]
59+
then echo "Cannot use -d and -h together" 1>&2
60+
exit 1
3961
fi
4062

4163
cat "$@" |
@@ -127,7 +149,7 @@ awk ' BEGIN { narr_slot = 0; oldnarr_slot=0; save_working = "";
127149
{
128150
# We have a filename, so we look at the previous
129151
# narrative to see if it is new narrative text.
130-
if ($0 ~ "^/" || $0 ~ ">/")
152+
if ($0 ~ "^/")
131153
{
132154
# If there are a different number of narrative
133155
# lines, they cannot possibly be the same.
@@ -243,4 +265,42 @@ then echo "<HTML>"
243265
echo "</BODY>"
244266
echo "</HTML>"
245267
else cat
268+
fi |
269+
270+
# if requested, remove any commit that has the "<branch>" text
271+
if [ "$DEL" = "Y" ]
272+
then awk 'BEGIN \
273+
{
274+
slot = 0;
275+
}
276+
277+
{
278+
# new commit?
279+
if ($0 ~ "^---$")
280+
{
281+
skip = "N";
282+
for (i=1; i <= slot; i++)
283+
if (commit[i] ~ "<branch>")
284+
skip = "Y";
285+
if (skip == "N")
286+
for (i=1; i <= slot; i++)
287+
print commit[i];
288+
slot = 0;
289+
}
290+
291+
# accumulate commit
292+
commit[++slot] = $0;
293+
}
294+
295+
END \
296+
{
297+
skip = "N";
298+
for (i=1; i <= slot; i++)
299+
if (commit[i] ~ "<branch>")
300+
skip = "Y";
301+
if (skip == "N")
302+
for (i=1; i <= slot; i++)
303+
print commit[i];
304+
}'
305+
else cat
246306
fi

0 commit comments

Comments
 (0)