~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/tools/pgcvslog

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
:
 
2
# This utility is used to generate a compact list of changes
 
3
# for each release, bjm 2000-02-22
 
4
 
 
5
# Usage $0 file
 
6
 
 
7
# all branches: 
 
8
# cvs log -d '>1999-06-14 00:00:00 GMT' . > log
 
9
#
 
10
# head:
 
11
# cvs log -d'>2000-05-29 00:00:00 GMT' -b .
 
12
# branch:
 
13
# cvs log -d'>2000-05-29 00:00:00 GMT' -rREL7_3_STABLE` .
 
14
#
 
15
# date range
 
16
# cvs log -d'2000-05-08 00:00:00 GMT<2000-05-29 00:00:00 GMT' -b .
 
17
#
 
18
# Remove TODO and FAQ logs if desired
 
19
#
 
20
 
 
21
if [ "X$1" == "X-h" ]
 
22
then    HTML="Y"
 
23
        shift
 
24
else    HTML="N"
 
25
fi
 
26
 
 
27
cat "$@" |
 
28
 
 
29
# protect HTML input if in HTML mode
 
30
if [ "$HTML" = "Y" ]
 
31
then    sed     -e 's/\&/\&amp;/g' \
 
32
                -e 's/</\&lt;/g' \
 
33
                -e 's/>/\&gt;/g' \
 
34
                -e 's/"/\&quot;/g'
 
35
else    cat
 
36
fi |
 
37
 
 
38
# mark each line with a datetime and line number, for sorting and merging
 
39
# We don't print anything from the -- or == line and the date:
 
40
 
 
41
awk '   BEGIN   {html="'"$HTML"'"; lineno = 0;}
 
42
        # store working directory
 
43
        $0 ~ /^Working file:/   {workingfile = "/" $3}
 
44
 
 
45
        ($0 ~ /^====*$/ || $0 ~ /^----*$/) \
 
46
        {
 
47
                # print blank line to separate entries
 
48
                if (datetime != "")
 
49
                {
 
50
                        if (html != "Y")
 
51
                                printf ("%s| %10d|%s\n", datetime, lineno++, "");
 
52
                        printf ("%s| %10d|", datetime, lineno++);
 
53
                        if (html != "Y")
 
54
                                printf ("%s\n", "---");
 
55
                        else    printf ("<HR>\n");
 
56
                }
 
57
                datetime="";
 
58
        }
 
59
 
 
60
        # if we have a saved datetime, print filename, date line, and committer
 
61
        datetime != "" && $1 != "branches:" {printf ("%s| %10d| %s\n", datetime, lineno++, $0);}
 
62
 
 
63
        $1 == "date:" \
 
64
        {
 
65
                # get entry date
 
66
                datetime=$2"-"$3
 
67
                if (workingfile != "")
 
68
                {
 
69
                        printf ("%s| %10d|", datetime, lineno++);
 
70
                        if (html != "Y")
 
71
                                printf ("%s\n", workingfile);
 
72
                        else    printf ("<SMALL><FONT COLOR=\"red\">%s</FONT></SMALL>\n", workingfile);
 
73
 
 
74
                        # output name of committer
 
75
                        # remove semicolon from committers name
 
76
                        gsub("/", "-", $2);
 
77
                        gsub(";", "", $3);
 
78
                        gsub(";", "", $5);
 
79
                        printf ("%s| %10d|", datetime, lineno++);
 
80
                        if (html != "Y")
 
81
                                printf ("%78s\n", $5);
 
82
                        else    printf ("<DIV ALIGN=\"right\"><SMALL><FONT COLOR=\"teal\">%s</FONT> <FONT COLOR=\"green\">%s</FONT></SMALL></DIV>\n", $5, $2);
 
83
                }
 
84
        }
 
85
 
 
86
        /* clear working file */
 
87
        $0 ~ /^====*$/  {workingfile=""}' |
 
88
 
 
89
sort | cut -d'|' -f3 | cat |
 
90
 
 
91
# collect duplicate narratives
 
92
 
 
93
awk '   BEGIN   { slot = 0; oldslot=0; save_working = ""; html="'"$HTML"'"}
 
94
        {
 
95
                # We have a filename, so we look at the previous
 
96
                # narrative to see if it is new narrative text.
 
97
                if ($0 ~ /^\// || $0 ~ />\//)
 
98
                {
 
99
                        # If there are a different number of narrative
 
100
                        # lines, they can not possibly be the same.
 
101
                        if (slot != oldslot)
 
102
                                same = "N";
 
103
                        else
 
104
                        {
 
105
                                same = "Y";
 
106
                                for (i=1; i <= slot; i++)
 
107
                                {
 
108
                                        if (oldnarr[i] != narr[i])
 
109
                                        {
 
110
                                                same = "N";
 
111
                                                break;
 
112
                                        }
 
113
                                }
 
114
                        }
 
115
 
 
116
                        # dump out the old narrative if it is new
 
117
                        if (same == "N")
 
118
                        {
 
119
                                if (oldslot)
 
120
                                        for (i=1; i <= oldslot; i++)
 
121
                                        {
 
122
                                                print oldnarr[i];
 
123
                                                if (html == "Y" && 
 
124
                                                    oldnarr[i] != "<HR>" &&
 
125
                                                    oldnarr[i] !~ "^<DIV ")
 
126
                                                        print "<BR>";
 
127
                                        }
 
128
 
 
129
                                # save the current narrative
 
130
                                for (i=1; i <= slot; i++)
 
131
                                        oldnarr[i] = narr[i];
 
132
                                oldslot = slot;
 
133
                        }
 
134
                        slot = 0;
 
135
 
 
136
                        # dump out the previous filename
 
137
                        print save_working;
 
138
                        if (html == "Y")
 
139
                                print "<BR>";
 
140
 
 
141
                        # store the current filename for later printing
 
142
                        save_working = $0;
 
143
                }
 
144
                else
 
145
                # we have a narrative line
 
146
                {
 
147
                        # accumulate narrative
 
148
                        narr[++slot] = $0;
 
149
                }
 
150
        }
 
151
        END     {
 
152
                        # If there are a different number of narrative
 
153
                        # lines, they can not possibly be the same.
 
154
                        if (slot != oldslot)
 
155
                                same = "N";
 
156
                        else
 
157
                        {
 
158
                                same = "Y";
 
159
                                for (i=1; i <= slot; i++)
 
160
                                {
 
161
                                        if (oldnarr[i] != narr[i])
 
162
                                        {
 
163
                                                same = "N";
 
164
                                                break;
 
165
                                        }
 
166
                                }
 
167
                        }
 
168
 
 
169
                        # dump out the old narrative if it is new
 
170
                        if (same == "N")
 
171
                        {
 
172
                                if (oldslot)
 
173
                                        for (i=1; i <= oldslot; i++)
 
174
                                        {
 
175
                                                print oldnarr[i];
 
176
                                                if (html == "Y" && 
 
177
                                                    oldnarr[i] != "<HR>" &&
 
178
                                                    oldnarr[i] !~ "^<DIV ")
 
179
                                                        print "<BR>";
 
180
                                        }
 
181
                        }
 
182
 
 
183
                        # dump out the last filename
 
184
                        print save_working;
 
185
 
 
186
                        if (html == "Y")
 
187
                                print "<BR>";
 
188
 
 
189
                        # dump out the last narrative
 
190
                        for (i=1; i <= slot; i++)
 
191
                        {
 
192
                                print narr[i];
 
193
                                if (html == "Y" && 
 
194
                                    narr[i] != "<HR>" &&
 
195
                                    narr[i] !~ "^<DIV ")
 
196
                                        print "<BR>";
 
197
                        }
 
198
                }' |
 
199
 
 
200
# add HTML wrapper
 
201
if [ "$HTML" = "Y" ]
 
202
then    echo "<HTML>"
 
203
        echo "<HEAD>"
 
204
        echo "<TITLE>CVS</TITLE>"
 
205
        echo "</HEAD>"
 
206
        echo "<BODY>"
 
207
        cat
 
208
        echo "</BODY>"
 
209
        echo "</HTML>"
 
210
else    cat
 
211
fi