annotate lib-src/rcs2log @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents 376386a54a3c
children 929b76928fce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 #!/bin/sh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 # RCS to ChangeLog generator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 # Generate a change log prefix from RCS files and the ChangeLog (if any).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 # Output the new prefix to standard output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 # You can edit this prefix by hand, and then prepend it to ChangeLog.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 # Ignore log entries that start with `#'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 # Clump together log entries that start with `{topic} ',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 # where `topic' contains neither white space nor `}'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 # Author: Paul Eggert <eggert@twinsun.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 # !Id: rcs2log,v 1.18 1994/08/15 22:44:10 eggert Exp !
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 # Copyright 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 # This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 # it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 # the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 # any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 # This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 # GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 # You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 # along with this program; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 nl='
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 # Parse options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 # defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 : ${TMPDIR=/tmp}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 hostname= # name of local host (if empty, will deduce it later)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 indent=8 # indent of log line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 initialize_fullname= # awk assignments to set up fullname array
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 initialize_mailaddr= # awk assignments to set up mailaddr array
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 length=79 # suggested max width of log line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 logins= # login names for people we know fullnames and mailaddresses of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 loginsout= # temporary file holding sorted logins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 rlog_options= # options to pass to rlog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 tabwidth=8 # width of horizontal tab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 while :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 case $1 in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 -i) indent=${2?};;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 -h) hostname=${2?};;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 -l) length=${2?};;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 -n) logins=$logins$nl${2?}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 loginsout=$TMPDIR/rcs2log$$l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 case $2${3?}${4?} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 *\"* | *\\* | *"$nl"*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 echo >&2 "$0: -n '$2' '$3' '$4': special characters not allowed"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 exit 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 initialize_fullname="$initialize_fullname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 fullname[\"$2\"] = \"$3\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 initialize_mailaddr="$initialize_mailaddr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 mailaddr[\"$2\"] = \"$4\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 shift; shift;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 -r) rlog_options=$rlog_options$nl${2?};;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 -t) tabwidth=${2?};;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 -*) echo >&2 "$0: usage: $0 [options] [file ...]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 Options:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 [-h hostname] [-i indent] [-l length] [-n login fullname mailaddr]...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 [-r rlog_option]... [-t tabwidth]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 exit 1;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 *) break
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 shift; shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 month_data='
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 m[0]="Jan"; m[1]="Feb"; m[2]="Mar"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 m[3]="Apr"; m[4]="May"; m[5]="Jun"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 m[6]="Jul"; m[7]="Aug"; m[8]="Sep"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 # days in non-leap year thus far, indexed by month (0-12)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 mo[0]=0; mo[1]=31; mo[2]=59; mo[3]=90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 mo[4]=120; mo[5]=151; mo[6]=181; mo[7]=212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 mo[8]=243; mo[9]=273; mo[10]=304; mo[11]=334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 mo[12]=365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 # Log into $rlogout the revisions checked in since the first ChangeLog entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 date=1970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 if test -s ChangeLog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 # Add 1 to seconds to avoid duplicating most recent log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 e='
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 '"$month_data"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 year = $5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 for (i=0; i<=11; i++) if (m[i] == $2) break
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 dd = $3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 hh = substr($0,12,2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 mm = substr($0,15,2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ss = substr($0,18,2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ss++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 if (ss == 60) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ss = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 mm++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 if (mm == 60) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 mm = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 hh++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 if (hh == 24) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 hh = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 dd++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 monthdays = mo[i+1] - mo[i]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 if (i == 1 && year%4 == 0 && (year%100 != 0 || year%400 == 0)) monthdays++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 if (dd == monthdays + 1) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 dd = 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 i++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 if (i == 12) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 i = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 year++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 printf "%d/%02d/%02d %02d:%02d:%02d\n", year, i+1, dd, hh, mm, ss
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 d=`awk "$e" <ChangeLog` || exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 case $d in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ?*) date=$d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 datearg="-d>$date"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 repository=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 rlog=rlog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 case $CVSROOT in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ?*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 if test -d "$CVSROOT" && test -f CVS/Repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 r=`cat <CVS/Repository` || exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 if test -d "$CVSROOT/$r"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 repository=$CVSROOT/$r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 rlog='cvs log'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 fi
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 # With no arguments, examine all files under the RCS directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 case $# in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 case $repository in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 '')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 files=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 for file in RCS/.* RCS/* .*,v *,v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 case $file in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 RCS/. | RCS/..) continue;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 files=$files$nl$file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 case $files in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 '') exit 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 oldIFS=$IFS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 IFS=$nl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 set $files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 IFS=$oldIFS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 rlogout=$TMPDIR/rcs2log$$r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 trap exit 1 2 13 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 trap "rm -f $loginsout $rlogout; exit 1" 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 $rlog "$datearg" $rlog_options ${1+"$@"} >$rlogout || exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 # Get the full name of each author the logs mention, and set initialize_fullname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 # to awk code that initializes the `fullname' awk associative array.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 # you have to fix the resulting output by hand.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 case $loginsout in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ?*) sort -u -o $loginsout <<EOF || exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 $logins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 EOF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 authors=`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 sed -n 's|^date: *[0-9]*[-/][0-9][0-9][-/][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9]*; *author: *\([^; ]*\).*|\1|p' <$rlogout |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 case $loginsout in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 '') sort -u;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ?*) sort -u | comm -23 - $loginsout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 `
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 case $authors in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ?*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 initialize_author=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 for author in $authors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 initialize_author="$initialize_author
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 author[\"$author\"] = 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 awkscript='
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 BEGIN {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 alphabet = "abcdefghijklmnopqrstuvwxyz"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 '"$initialize_author"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 if (author[$1]) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 fullname = $5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 if (fullname ~ /[0-9]+-[^(]*\([0-9]+\)$/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 # Remove the junk from fullnames like "0000-Admin(0000)".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 fullname = substr(fullname, index(fullname, "-") + 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 fullname = substr(fullname, 1, index(fullname, "(") - 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 if (fullname ~ /,[^ ]/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 # Some sites put comma-separated junk after the fullname.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 # Remove it, but leave "Bill Gates, Jr" alone.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 fullname = substr(fullname, 1, index(fullname, ",") - 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 abbr = index(fullname, "&")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 if (abbr) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 a = substr($1, 1, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 A = a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 i = index(alphabet, a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 if (i) A = substr(ALPHABET, i, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 fullname = substr(fullname, 1, abbr-1) A substr($1, 2) substr(fullname, abbr+1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 printf "fullname[\"%s\"] = \"%s\"\n", $1, fullname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 author[$1] = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 initialize_fullname=`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (cat /etc/passwd; ypmatch $authors passwd) 2>/dev/null |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 awk -F: "$awkscript"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 `$initialize_fullname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 # Function to print a single log line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 # We don't use awk functions, to stay compatible with old awk versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 # `Log' is the log message (with \n replaced by \r).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 # `files' contains the affected files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 printlogline='{
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 # Following the GNU coding standards, rewrite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 # * file: (function): comment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 # to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 # * file (function): comment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 if (Log ~ /^\([^)]*\): /) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 i = index(Log, ")")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 files = files " " substr(Log, 1, i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 Log = substr(Log, i+3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 # If "label: comment" is too long, break the line after the ":".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 sep = " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, CR)) sep = "\n" indent_string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 # Print the label.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 printf "%s*%s:", indent_string, files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 # Print each line of the log, transliterating \r to \n.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 while ((i = index(Log, CR)) != 0) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 logline = substr(Log, 1, i-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 if (logline ~ /[^ ]/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 printf "%s%s\n", sep, logline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 print ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 sep = indent_string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 Log = substr(Log, i+1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 }'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 case $hostname in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 '')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 hostname=`(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 hostname || uname -n || uuname -l || cat /etc/whoami
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ) 2>/dev/null` || {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 echo >&2 "$0: cannot deduce hostname"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 exit 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 esac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 # Process the rlog output, generating ChangeLog style entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 # First, reformat the rlog output so that each line contains one log entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 # Transliterate \n to \r so that multiline entries fit on a single line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 # Discard irrelevant rlog output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 awk <$rlogout '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 /^Working file:/ { filename = $3 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 /^date: /, /^(-----------*|===========*)$/ {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 if ($0 ~ /^branches: /) { next }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 if ($0 ~ /^date: [0-9][- +\/0-9:]*;/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 date = $2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 if (date ~ /-/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 # An ISO format date. Replace all "-"s with "/"s.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 newdate = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 while ((i = index(date, "-")) != 0) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 newdate = newdate substr(date, 1, i-1) "/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 date = substr(date, i+1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 date = newdate date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 # Ignore any time zone; ChangeLog has no room for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 time = substr($3, 1, 8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 author = substr($5, 1, length($5)-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 printf "%s %s %s %s %c", filename, date, time, author, 13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 printf "%s%c", $0, 13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ' |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 # Now each line is of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 # FILENAME YYYY/MM/DD HH:MM:SS AUTHOR \rLOG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 # where \r stands for a carriage return,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 # and each line of the log is terminated by \r instead of \n.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 # Sort the log entries, first by date+time (in reverse order),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 # then by author, then by log entry, and finally by file name (just in case).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 sort +1 -3r +3 +0 |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 # Finally, reformat the sorted log entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 awk '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 BEGIN {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 # Some awks do not understand "\r" or "\013", so we have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 # put a carriage return directly in the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 CR=" " # <-- There is a single CR between the " chars here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 # Initialize the fullname and mailaddr associative arrays.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 '"$initialize_fullname"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 '"$initialize_mailaddr"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 # Initialize indent string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 indent_string = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 i = '"$indent"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 if (0 < '"$tabwidth"')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 indent_string = indent_string "\t"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 while (1 <= i--)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 indent_string = indent_string " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 # Set up date conversion tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 # RCS uses a nice, clean, sortable format,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 # but ChangeLog wants the traditional, ugly ctime format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 # January 1, 0 AD (Gregorian) was Saturday = 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 EPOCH_WEEKDAY = 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 # Of course, there was no 0 AD, but the algorithm works anyway.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 w[0]="Sun"; w[1]="Mon"; w[2]="Tue"; w[3]="Wed"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 w[4]="Thu"; w[5]="Fri"; w[6]="Sat"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 '"$month_data"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 newlog = substr($0, 1 + index($0, CR))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 # Ignore log entries prefixed by "#".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 if (newlog ~ /^#/) { next }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 if (Log != newlog || date != $2 || author != $4) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 # The previous log and this log differ.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 # Print the old log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 if (date != "") '"$printlogline"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 # Logs that begin with "{clumpname} " should be grouped together,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 # and the clumpname should be removed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 # Extract the new clumpname from the log header,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 # and use it to decide whether to output a blank line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 newclumpname = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 sep = "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 if (date == "") sep = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 if (newlog ~ /^\{[^ }]*}[ ]/) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 i = index(newlog, "}")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 newclumpname = substr(newlog, 1, i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 while (substr(newlog, i+1) ~ /^[ ]/) i++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 newlog = substr(newlog, i+1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 if (clumpname == newclumpname) sep = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 printf sep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 clumpname = newclumpname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 # Get ready for the next log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 Log = newlog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 if (files != "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 for (i in filesknown)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 filesknown[i] = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 files = ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 if (date != $2 || author != $4) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 # The previous date+author and this date+author differ.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 # Print the new one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 date = $2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 author = $4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 # Convert nice RCS date like "1992/01/03 00:03:44"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 # into ugly ctime date like "Fri Jan 3 00:03:44 1992".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 # Calculate day of week from Gregorian calendar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 i = index($2, "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 year = substr($2, 1, i-1) + 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 monthday = substr($2, i+1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 i = index(monthday, "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 month = substr(monthday, 1, i-1) + 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 day = substr(monthday, i+1) + 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 leap = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 if (2 < month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 days_since_Sunday_before_epoch = EPOCH_WEEKDAY + year * 365 + int((year + 3) / 4) - int((year + 99) / 100) + int((year + 399) / 400) + mo[month-1] + leap + day - 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 # Print "date fullname (email address)".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 # Get fullname and email address from associative arrays;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 # default to author and author@hostname if not in arrays.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 if (fullname[author])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 auth = fullname[author]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 auth = author
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 printf "%s %s %2d %s %d %s ", w[days_since_Sunday_before_epoch%7], m[month-1], day, $3, year, auth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 if (mailaddr[author])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 printf "<%s>\n\n", mailaddr[author]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 printf "<%s@%s>\n\n", author, "'"$hostname"'"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 if (! filesknown[$1]) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 filesknown[$1] = 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 if (files == "") files = " " $1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 else files = files ", " $1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 END {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 # Print the last log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 if (date != "") {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 '"$printlogline"'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 printf "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ' &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 # Exit successfully.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 exec rm -f $loginsout $rlogout