|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
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 $ |
4 | 4 |
|
5 | 5 | # This utility is used to generate a compact list of changes
|
6 | 6 | # for each release, bjm 2000-02-22
|
7 | 7 |
|
8 |
| -# Usage: pgcvslog [-h] |
| 8 | +# Usage: pgcvslog [-d] [-h] |
| 9 | +# -d delete commits that include back branches |
9 | 10 | # -h is HTML output
|
10 | 11 |
|
| 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 | + |
11 | 17 | # All branches:
|
12 | 18 | # cvs log -d'>1999-06-14 00:00:00 GMT' . > log
|
13 | 19 | #
|
|
32 | 38 | # /cvsroot/pgsql/doc/src/FAQ/FAQ.html
|
33 | 39 | #
|
34 | 40 |
|
| 41 | +HTML="N" |
| 42 | +DEL="N" |
35 | 43 | if [ "X$1" = "X-h" ]
|
36 | 44 | then HTML="Y"
|
37 | 45 | 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 |
39 | 61 | fi
|
40 | 62 |
|
41 | 63 | cat "$@" |
|
@@ -127,7 +149,7 @@ awk ' BEGIN { narr_slot = 0; oldnarr_slot=0; save_working = "";
|
127 | 149 | {
|
128 | 150 | # We have a filename, so we look at the previous
|
129 | 151 | # narrative to see if it is new narrative text.
|
130 |
| - if ($0 ~ "^/" || $0 ~ ">/") |
| 152 | + if ($0 ~ "^/") |
131 | 153 | {
|
132 | 154 | # If there are a different number of narrative
|
133 | 155 | # lines, they cannot possibly be the same.
|
@@ -243,4 +265,42 @@ then echo "<HTML>"
|
243 | 265 | echo "</BODY>"
|
244 | 266 | echo "</HTML>"
|
245 | 267 | 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 |
246 | 306 | fi
|
0 commit comments