12507
|
1 #! /bin/sh
|
527
|
2
|
|
3 # RCS to ChangeLog generator
|
|
4
|
94828
|
5 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
|
100898
|
6 # 2004, 2005, 2006, 2007, 2008, 2009
|
|
7 # Free Software Foundation, Inc.
|
94828
|
8
|
101095
|
9 # Author: Paul Eggert <eggert@twinsun.com>
|
|
10
|
94828
|
11 # This program is free software: you can redistribute it and/or modify
|
|
12 # it under the terms of the GNU General Public License as published by
|
|
13 # the Free Software Foundation, either version 3 of the License, or
|
|
14 # (at your option) any later version.
|
|
15
|
|
16 # This program is distributed in the hope that it will be useful,
|
|
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 # GNU General Public License for more details.
|
|
20
|
|
21 # You should have received a copy of the GNU General Public License
|
|
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
|
24
|
100898
|
25 Copyright='Copyright (C) 2009 Free Software Foundation, Inc.
|
94828
|
26 This program comes with NO WARRANTY, to the extent permitted by law.
|
|
27 You may redistribute copies of this program
|
|
28 under the terms of the GNU General Public License.
|
|
29 For more information about these matters, see the files named COPYING.
|
|
30 Author: Paul Eggert <eggert@twinsun.com>'
|
|
31
|
54965
|
32 Help='
|
|
33 Generate ChangeLog entries from RCS files (perhaps in a CVS repository)
|
|
34 and the ChangeLog file (if any). An RCS file typically has a name
|
|
35 ending in ",v", and represents the entire history of a file that is
|
|
36 under revision control. The ChangeLog file logs entries for changes,
|
|
37 in reverse chronological order.
|
|
38
|
|
39 Generate entries for changes entered into RCS (or CVS) more recently
|
|
40 than the newest existing entry in the ChangeLog file. You can then
|
|
41 edit these entries by hand, and prepend them to the ChangeLog file.
|
|
42
|
|
43 Output the resulting ChangeLog entries to standard output.
|
|
44 Each entry looks something like this:
|
|
45
|
|
46 2004-04-17 Paul Eggert <eggert@gnu.org>
|
527
|
47
|
54965
|
48 * rcs2log (Help): Clarify wording of the usage message.
|
|
49 Problem reported by Alan Mackenzie in
|
|
50 <http://mail.gnu.org/archive/html/bug-gnu-emacs/2004-04/msg00188.html>.
|
527
|
51
|
54965
|
52 ChangeLog entries contain the current date, full name, email address
|
|
53 including hostname, the name of the affected file, and commentary.
|
|
54 RCS and CVS logs lack full names and email addresses, so they are
|
|
55 inferred from login names using a heuristic that can be overridden
|
|
56 via the -u option.
|
|
57
|
|
58 Ignore log entries that start with "#".
|
|
59 Clump together log entries that start with "{topic} ",
|
|
60 where "topic" contains neither white space nor "}".
|
|
61
|
|
62 If no FILE is specified, use all files under the working directory
|
|
63 that are maintained under version control.
|
|
64
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
65 Options:
|
1800
|
66
|
54965
|
67 -c FILE Output ChangeLog entries for FILE (default ChangeLog).
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
68 -h HOSTNAME Use HOSTNAME in change log entries (default current host).
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
69 -i INDENT Indent change log lines by INDENT spaces (default 8).
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
70 -l LENGTH Try to limit log lines to LENGTH characters (default 79).
|
54965
|
71 -L FILE Use FILE (same format as "rlog") for source of logs.
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
72 -R If no FILEs are given and RCS is used, recurse through working directory.
|
54965
|
73 -r OPTION Pass OPTION to subsidiary command (either "rlog" or "cvs -q log").
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
74 -t TABWIDTH Tab stops are every TABWIDTH characters (default 8).
|
54965
|
75 -u "LOGIN<tab>FULLNAME<tab>EMAILADDR" LOGIN has FULLNAME and EMAILADDR.
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
76 -v Append RCS revision to file names in log lines.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
77 --help Output help.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
78 --version Output version number.
|
1800
|
79
|
23008
|
80 Report bugs to <bug-gnu-emacs@gnu.org>.'
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
81
|
64083
|
82 Id='$Id$'
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
83
|
39150
|
84 # Use the traditional C locale.
|
|
85 LANG=C
|
|
86 LANGUAGE=C
|
|
87 LC_ALL=C
|
|
88 LC_COLLATE=C
|
|
89 LC_CTYPE=C
|
|
90 LC_MESSAGES=C
|
|
91 LC_NUMERIC=C
|
|
92 LC_TIME=C
|
|
93 export LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_TIME
|
|
94
|
|
95 # These variables each contain a single ASCII character.
|
|
96 # Unfortunately, there's no portable way of writing these characters
|
|
97 # in older Unix implementations, other than putting them directly into
|
|
98 # this text file.
|
|
99 SOH='' # SOH, octal code 001
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
100 tab=' '
|
3248
|
101 nl='
|
|
102 '
|
1800
|
103
|
534
|
104 # Parse options.
|
|
105
|
|
106 # defaults
|
43097
|
107 AWK=${AWK-awk}
|
|
108 TMPDIR=${TMPDIR-/tmp}
|
15911
|
109 changelog=ChangeLog # change log file name
|
|
110 datearg= # rlog date option
|
4783
|
111 hostname= # name of local host (if empty, will deduce it later)
|
534
|
112 indent=8 # indent of log line
|
|
113 length=79 # suggested max width of log line
|
11627
|
114 logins= # login names for people we know fullnames and mailaddrs of
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
115 loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets
|
15911
|
116 logTZ= # time zone for log dates (if empty, use local time)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
117 recursive= # t if we want recursive rlog
|
15911
|
118 revision= # t if we want revision numbers
|
4783
|
119 rlog_options= # options to pass to rlog
|
39150
|
120 rlogfile= # log file to read from
|
534
|
121 tabwidth=8 # width of horizontal tab
|
|
122
|
|
123 while :
|
|
124 do
|
|
125 case $1 in
|
15911
|
126 -c) changelog=${2?}; shift;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
127 -i) indent=${2?}; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
128 -h) hostname=${2?}; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
129 -l) length=${2?}; shift;;
|
39150
|
130 -L) rlogfile=${2?}; shift;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
131 -[nu]) # -n is obsolescent; it is replaced by -u.
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
132 case $1 in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
133 -n) case ${2?}${3?}${4?} in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
134 *"$tab"* | *"$nl"*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
135 echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
|
39150
|
136 exit 1;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
137 esac
|
39150
|
138 login=$2
|
|
139 lfm=$2$tab$3$tab$4
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
140 shift; shift; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
141 -u)
|
11082
|
142 # If $2 is not tab-separated, use colon for separator.
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
143 case ${2?} in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
144 *"$nl"*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
145 echo >&2 "$0: -u '$2': newlines not allowed"
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
146 exit 1;;
|
11082
|
147 *"$tab"*)
|
|
148 t=$tab;;
|
|
149 *)
|
39150
|
150 t=':';;
|
11082
|
151 esac
|
|
152 case $2 in
|
|
153 *"$t"*"$t"*"$t"*)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
154 echo >&2 "$0: -u '$2': too many fields"
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
155 exit 1;;
|
11082
|
156 *"$t"*"$t"*)
|
39150
|
157 uf="[^$t]*$t" # An unselected field, followed by a separator.
|
|
158 sf="\\([^$t]*\\)" # The selected field.
|
|
159 login=`expr "X$2" : "X$sf"`
|
|
160 lfm="$login$tab"`
|
|
161 expr "X$2" : "$uf$sf"
|
|
162 `"$tab"`
|
|
163 expr "X$2" : "$uf$uf$sf"
|
|
164 `;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
165 *)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
166 echo >&2 "$0: -u '$2': not enough fields"
|
39150
|
167 exit 1;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
168 esac
|
39150
|
169 shift;;
|
4783
|
170 esac
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
171 case $logins in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
172 '') logins=$login;;
|
39150
|
173 ?*) logins=$logins$nl$login;;
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
174 esac
|
39150
|
175 case $loginFullnameMailaddrs in
|
|
176 '') loginFullnameMailaddrs=$lfm;;
|
|
177 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$lfm;;
|
|
178 esac;;
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
179 -r)
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
180 case $rlog_options in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
181 '') rlog_options=${2?};;
|
39150
|
182 ?*) rlog_options=$rlog_options$nl${2?};;
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
183 esac
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
184 shift;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
185 -R) recursive=t;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
186 -t) tabwidth=${2?}; shift;;
|
15911
|
187 -v) revision=t;;
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
188 --version)
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
189 set $Id
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
190 rcs2logVersion=$3
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
191 echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright"
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
192 exit 0;;
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
193 -*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help"
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
194 case $1 in
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
195 --help) exit 0;;
|
39150
|
196 *) exit 1;;
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
197 esac;;
|
39150
|
198 *) break;;
|
534
|
199 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
200 shift
|
534
|
201 done
|
|
202
|
2220
|
203 month_data='
|
|
204 m[0]="Jan"; m[1]="Feb"; m[2]="Mar"
|
|
205 m[3]="Apr"; m[4]="May"; m[5]="Jun"
|
|
206 m[6]="Jul"; m[7]="Aug"; m[8]="Sep"
|
|
207 m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
|
|
208 '
|
|
209
|
35016
|
210 logdir=$TMPDIR/rcs2log$$
|
|
211 llogout=$logdir/l
|
527
|
212 trap exit 1 2 13 15
|
35016
|
213 trap "rm -fr $logdir 2>/dev/null" 0
|
|
214 (umask 077 && exec mkdir $logdir) || exit
|
527
|
215
|
39150
|
216 # If no rlog-format log file is given, generate one into $rlogfile.
|
|
217 case $rlogfile in
|
|
218 '')
|
|
219 rlogfile=$logdir/r
|
|
220
|
|
221 # If no rlog options are given,
|
|
222 # log the revisions checked in since the first ChangeLog entry.
|
53317
|
223 # Since ChangeLog is only by date, some of these revisions may be
|
|
224 # duplicates of what's already in ChangeLog; it's the user's
|
|
225 # responsibility to remove them.
|
39150
|
226 case $rlog_options in
|
|
227 '')
|
|
228 if test -s "$changelog"
|
|
229 then
|
|
230 e='
|
|
231 /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{
|
|
232 # ISO 8601 date
|
|
233 print $1
|
|
234 exit
|
|
235 }
|
|
236 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
|
|
237 # old-fashioned date and time (Emacs 19.31 and earlier)
|
|
238 '"$month_data"'
|
|
239 year = $5
|
|
240 for (i=0; i<=11; i++) if (m[i] == $2) break
|
|
241 dd = $3
|
|
242 printf "%d-%02d-%02d\n", year, i+1, dd
|
|
243 exit
|
|
244 }
|
|
245 '
|
|
246 d=`$AWK "$e" <"$changelog"` || exit
|
|
247 case $d in
|
|
248 ?*) datearg="-d>$d";;
|
|
249 esac
|
|
250 fi;;
|
|
251 esac
|
|
252
|
|
253 # Use TZ specified by ChangeLog local variable, if any.
|
|
254 if test -s "$changelog"
|
|
255 then
|
|
256 extractTZ='
|
|
257 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{
|
|
258 s//\1/; p; q
|
|
259 }
|
|
260 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{
|
|
261 s//UTC0/; p; q
|
|
262 }
|
|
263 '
|
|
264 logTZ=`tail "$changelog" | sed -n "$extractTZ"`
|
|
265 case $logTZ in
|
|
266 ?*) TZ=$logTZ; export TZ;;
|
|
267 esac
|
|
268 fi
|
|
269
|
|
270 # If CVS is in use, examine its repository, not the normal RCS files.
|
|
271 if test ! -f CVS/Repository
|
|
272 then
|
|
273 rlog=rlog
|
|
274 repository=
|
|
275 else
|
|
276 rlog='cvs -q log'
|
|
277 repository=`sed 1q <CVS/Repository` || exit
|
|
278 test ! -f CVS/Root || CVSROOT=`cat <CVS/Root` || exit
|
53947
|
279 pository=
|
39150
|
280 case $CVSROOT in
|
53947
|
281 /* | :fork:* | :local:*) ;;
|
|
282 */*)
|
39150
|
283 # remote repository
|
53947
|
284 pository=`expr "X$CVSROOT" : '[^/]*\(.*\)'`;;
|
|
285 esac
|
|
286 case $pository in
|
|
287 '')
|
39150
|
288 # local repository
|
|
289 case $repository in
|
|
290 /*) ;;
|
53947
|
291 *)
|
|
292 repository=${CVSROOT?}/$repository
|
|
293 case $repository in
|
|
294 :fork:* | :local:*)
|
|
295 repository=`expr "$repository" : ':[^:]*:\(.*\)'`;;
|
|
296 esac;;
|
39150
|
297 esac
|
|
298 if test ! -d "$repository"
|
|
299 then
|
|
300 echo >&2 "$0: $repository: bad repository (see CVS/Repository)"
|
|
301 exit 1
|
|
302 fi
|
|
303 pository=$repository;;
|
|
304 esac
|
|
305
|
|
306 # Ensure that $pository ends in exactly one slash.
|
|
307 while :
|
|
308 do
|
|
309 case $pository in
|
|
310 *//) pository=`expr "X$pository" : 'X\(.*\)/'`;;
|
|
311 */) break;;
|
|
312 *) pository=$pository/; break;;
|
|
313 esac
|
|
314 done
|
|
315
|
53317
|
316 # If no rlog options are given, and if we are in a tagged CVS branch,
|
|
317 # log only the changes in that branch.
|
|
318 case $rlog_options in
|
|
319 '')
|
|
320 if test -f CVS/Tag
|
|
321 then
|
|
322 CVSTAG=`cat <CVS/Tag` || exit
|
|
323 case $CVSTAG in
|
|
324 T?*)
|
|
325 rlog_options=-r`expr "$CVSTAG" : 'T\(.*\)'`;;
|
|
326 *)
|
|
327 echo >&2 "$0: invalid CVS/Tag"; exit 1;;
|
|
328 esac
|
|
329 fi;;
|
|
330 esac
|
39150
|
331 fi
|
|
332
|
|
333 # Use $rlog's -zLT option, if $rlog supports it.
|
|
334 case `$rlog -zLT 2>&1` in
|
|
335 *' option'*) ;;
|
|
336 *)
|
|
337 case $rlog_options in
|
|
338 '') rlog_options=-zLT;;
|
|
339 ?*) rlog_options=-zLT$nl$rlog_options;;
|
|
340 esac;;
|
|
341 esac
|
|
342
|
|
343 # With no arguments, examine all files under the RCS directory.
|
|
344 case $# in
|
|
345 0)
|
|
346 case $repository in
|
|
347 '')
|
|
348 oldIFS=$IFS
|
|
349 IFS=$nl
|
|
350 case $recursive in
|
|
351 t)
|
|
352 RCSdirs=`find . -name RCS -type d -print`
|
|
353 filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||'
|
|
354 files=`
|
|
355 {
|
|
356 case $RCSdirs in
|
|
357 ?*) find $RCSdirs \
|
|
358 -type f \
|
|
359 ! -name '*_' \
|
|
360 ! -name ',*,' \
|
|
361 ! -name '.*_' \
|
|
362 ! -name .rcsfreeze.log \
|
|
363 ! -name .rcsfreeze.ver \
|
|
364 -print;;
|
|
365 esac
|
|
366 find . -name '*,v' -print
|
|
367 } |
|
|
368 sort -u |
|
|
369 sed "$filesFromRCSfiles"
|
|
370 `;;
|
|
371 *)
|
|
372 files=
|
|
373 for file in RCS/.* RCS/* .*,v *,v
|
|
374 do
|
|
375 case $file in
|
|
376 RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;;
|
|
377 RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;;
|
|
378 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;;
|
|
379 RCS/*,v | RCS/.*,v) ;;
|
|
380 RCS/* | RCS/.*) test -f "$file" || continue;;
|
|
381 esac
|
|
382 case $files in
|
|
383 '') files=$file;;
|
|
384 ?*) files=$files$nl$file;;
|
|
385 esac
|
|
386 done
|
|
387 case $files in
|
|
388 '') exit 0;;
|
|
389 esac;;
|
|
390 esac
|
|
391 set x $files
|
|
392 shift
|
|
393 IFS=$oldIFS;;
|
|
394 esac;;
|
|
395 esac
|
|
396
|
|
397 case $datearg in
|
|
398 ?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogfile;;
|
|
399 '') $rlog $rlog_options ${1+"$@"} >$rlogfile;;
|
|
400 esac || exit;;
|
|
401 esac
|
527
|
402
|
|
403
|
43097
|
404 # Prefer the POSIX-style -k options, since POSIX 1003.1-2001 prohibits
|
|
405 # support for the traditional-style +M -N options.
|
|
406 SORT_K_OPTIONS='-k 3,4r -k 5 -k 1'
|
|
407 sort $SORT_K_OPTIONS </dev/null 2>/dev/null || SORT_K_OPTIONS='+2 -4r +4 +0'
|
|
408
|
|
409
|
527
|
410 # Get the full name of each author the logs mention, and set initialize_fullname
|
|
411 # to awk code that initializes the `fullname' awk associative array.
|
|
412 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
|
|
413 # you have to fix the resulting output by hand.
|
|
414
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
415 initialize_fullname=
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
416 initialize_mailaddr=
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
417
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
418 case $loginFullnameMailaddrs in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
419 ?*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
420 case $loginFullnameMailaddrs in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
421 *\"* | *\\*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
422 sed 's/["\\]/\\&/g' >$llogout <<EOF || exit
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
423 $loginFullnameMailaddrs
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
424 EOF
|
39150
|
425 loginFullnameMailaddrs=`cat $llogout`;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
426 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
427
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
428 oldIFS=$IFS
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
429 IFS=$nl
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
430 for loginFullnameMailaddr in $loginFullnameMailaddrs
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
431 do
|
39150
|
432 IFS=$tab
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
433 set x $loginFullnameMailaddr
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
434 login=$2
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
435 fullname=$3
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
436 mailaddr=$4
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
437 initialize_fullname="$initialize_fullname
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
438 fullname[\"$login\"] = \"$fullname\""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
439 initialize_mailaddr="$initialize_mailaddr
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
440 mailaddr[\"$login\"] = \"$mailaddr\""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
441 done
|
39150
|
442 IFS=$oldIFS;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
443 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
444
|
39150
|
445 case $logins in
|
|
446 ?*)
|
|
447 sort -u -o $llogout <<EOF
|
4783
|
448 $logins
|
|
449 EOF
|
39150
|
450 ;;
|
|
451 '')
|
|
452 : ;;
|
|
453 esac >$llogout || exit
|
|
454
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
455 output_authors='/^date: / {
|
12066
b9b0b3f96dc2
(output_authors): Allow ':' in time zone, as per ISO 8601 and RCS 5.6.8 beta.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
456 if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/ && $4 == "author:" && $5 ~ /^[^;]*;$/) {
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
457 print substr($5, 1, length($5)-1)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
458 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
459 }'
|
527
|
460 authors=`
|
39150
|
461 $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - $llogout
|
527
|
462 `
|
640
|
463 case $authors in
|
|
464 ?*)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
465 cat >$llogout <<EOF || exit
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
466 $authors
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
467 EOF
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
468 initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/'
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
469 initialize_author=`sed -e "$initialize_author_script" <$llogout`
|
640
|
470 awkscript='
|
|
471 BEGIN {
|
|
472 alphabet = "abcdefghijklmnopqrstuvwxyz"
|
|
473 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
474 '"$initialize_author"'
|
|
475 }
|
|
476 {
|
|
477 if (author[$1]) {
|
|
478 fullname = $5
|
4504
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
479 if (fullname ~ /[0-9]+-[^(]*\([0-9]+\)$/) {
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
480 # Remove the junk from fullnames like "0000-Admin(0000)".
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
481 fullname = substr(fullname, index(fullname, "-") + 1)
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
482 fullname = substr(fullname, 1, index(fullname, "(") - 1)
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
483 }
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
484 if (fullname ~ /,[^ ]/) {
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
485 # Some sites put comma-separated junk after the fullname.
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
486 # Remove it, but leave "Bill Gates, Jr" alone.
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
487 fullname = substr(fullname, 1, index(fullname, ",") - 1)
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
488 }
|
640
|
489 abbr = index(fullname, "&")
|
|
490 if (abbr) {
|
|
491 a = substr($1, 1, 1)
|
|
492 A = a
|
|
493 i = index(alphabet, a)
|
|
494 if (i) A = substr(ALPHABET, i, 1)
|
|
495 fullname = substr(fullname, 1, abbr-1) A substr($1, 2) substr(fullname, abbr+1)
|
|
496 }
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
497
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
498 # Quote quotes and backslashes properly in full names.
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
499 # Do not use gsub; traditional awk lacks it.
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
500 quoted = ""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
501 rest = fullname
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
502 for (;;) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
503 p = index(rest, "\\")
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
504 q = index(rest, "\"")
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
505 if (p) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
506 if (q && q<p) p = q
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
507 } else {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
508 if (!q) break
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
509 p = q
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
510 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
511 quoted = quoted substr(rest, 1, p-1) "\\" substr(rest, p, 1)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
512 rest = substr(rest, p+1)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
513 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
514
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
515 printf "fullname[\"%s\"] = \"%s%s\"\n", $1, quoted, rest
|
640
|
516 author[$1] = 0
|
|
517 }
|
|
518 }
|
|
519 '
|
|
520
|
|
521 initialize_fullname=`
|
22999
|
522 {
|
|
523 (getent passwd $authors) ||
|
|
524 (
|
|
525 cat /etc/passwd
|
|
526 for author in $authors
|
|
527 do NIS_PATH= nismatch $author passwd.org_dir
|
|
528 done
|
|
529 ypmatch $authors passwd
|
|
530 )
|
|
531 } 2>/dev/null |
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
532 $AWK -F: "$awkscript"
|
39150
|
533 `$initialize_fullname;;
|
640
|
534 esac
|
527
|
535
|
|
536
|
|
537 # Function to print a single log line.
|
|
538 # We don't use awk functions, to stay compatible with old awk versions.
|
39150
|
539 # `Log' is the log message.
|
594
|
540 # `files' contains the affected files.
|
527
|
541 printlogline='{
|
|
542
|
|
543 # Following the GNU coding standards, rewrite
|
|
544 # * file: (function): comment
|
|
545 # to
|
|
546 # * file (function): comment
|
41649
|
547 if (Log ~ /^\([^)]*\):[\t\n ]/) {
|
527
|
548 i = index(Log, ")")
|
39150
|
549 filefunc = substr(Log, 1, i)
|
|
550 while ((j = index(filefunc, "\n"))) {
|
|
551 files = files " " substr(filefunc, 1, j-1)
|
|
552 filefunc = substr(filefunc, j+1)
|
|
553 }
|
|
554 files = files " " filefunc
|
527
|
555 Log = substr(Log, i+3)
|
|
556 }
|
|
557
|
|
558 # If "label: comment" is too long, break the line after the ":".
|
|
559 sep = " "
|
39150
|
560 i = index(Log, "\n")
|
|
561 if ('"$length"' <= '"$indent"' + 1 + length(files) + i) sep = "\n" indent_string
|
527
|
562
|
|
563 # Print the label.
|
534
|
564 printf "%s*%s:", indent_string, files
|
527
|
565
|
39150
|
566 # Print each line of the log.
|
|
567 while (i) {
|
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
568 logline = substr(Log, 1, i-1)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
569 if (logline ~ /[^'"$tab"' ]/) {
|
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
570 printf "%s%s\n", sep, logline
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
571 } else {
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
572 print ""
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
573 }
|
534
|
574 sep = indent_string
|
527
|
575 Log = substr(Log, i+1)
|
39150
|
576 i = index(Log, "\n")
|
527
|
577 }
|
|
578 }'
|
|
579
|
15911
|
580 # Pattern to match the `revision' line of rlog output.
|
|
581 rlog_revision_pattern='^revision [0-9]+\.[0-9]+(\.[0-9]+\.[0-9]+)*(['"$tab"' ]+locked by: [^'"$tab"' $,.0-9:;@]*[^'"$tab"' $,:;@][^'"$tab"' $,.0-9:;@]*;)?['"$tab"' ]*$'
|
|
582
|
4783
|
583 case $hostname in
|
|
584 '')
|
|
585 hostname=`(
|
|
586 hostname || uname -n || uuname -l || cat /etc/whoami
|
|
587 ) 2>/dev/null` || {
|
|
588 echo >&2 "$0: cannot deduce hostname"
|
|
589 exit 1
|
|
590 }
|
14173
|
591
|
|
592 case $hostname in
|
|
593 *.*) ;;
|
|
594 *)
|
|
595 domainname=`(domainname) 2>/dev/null` &&
|
|
596 case $domainname in
|
39150
|
597 *.*) hostname=$hostname.$domainname;;
|
|
598 esac;;
|
|
599 esac;;
|
4783
|
600 esac
|
527
|
601
|
|
602
|
|
603 # Process the rlog output, generating ChangeLog style entries.
|
|
604
|
|
605 # First, reformat the rlog output so that each line contains one log entry.
|
39150
|
606 # Transliterate \n to SOH so that multiline entries fit on a single line.
|
527
|
607 # Discard irrelevant rlog output.
|
39150
|
608 $AWK '
|
|
609 BEGIN {
|
|
610 pository = "'"$pository"'"
|
|
611 SOH="'"$SOH"'"
|
|
612 }
|
|
613 /^RCS file: / {
|
|
614 if (pository != "") {
|
|
615 filename = substr($0, 11)
|
|
616 if (substr(filename, 1, length(pository)) == pository) {
|
|
617 filename = substr(filename, length(pository) + 1)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
618 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
619 if (filename ~ /,v$/) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
620 filename = substr(filename, 1, length(filename) - 2)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
621 }
|
16507
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
622 if (filename ~ /(^|\/)Attic\/[^\/]*$/) {
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
623 i = length(filename)
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
624 while (substr(filename, i, 1) != "/") i--
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
625 filename = substr(filename, 1, i - 6) substr(filename, i + 1)
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
626 }
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
627 }
|
15911
|
628 rev = "?"
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
629 }
|
39150
|
630 /^Working file: / { if (repository == "") filename = substr($0, 15) }
|
15911
|
631 /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ {
|
18452
|
632 line = $0
|
|
633 if (line ~ /'"$rlog_revision_pattern"'/) {
|
15911
|
634 rev = $2
|
|
635 next
|
|
636 }
|
18452
|
637 if (line ~ /^date: [0-9][- +\/0-9:]*;/) {
|
8549
|
638 date = $2
|
15911
|
639 if (date ~ /\//) {
|
|
640 # This is a traditional RCS format date YYYY/MM/DD.
|
|
641 # Replace "/"s with "-"s to get ISO format.
|
8549
|
642 newdate = ""
|
15911
|
643 while ((i = index(date, "/")) != 0) {
|
|
644 newdate = newdate substr(date, 1, i-1) "-"
|
8549
|
645 date = substr(date, i+1)
|
|
646 }
|
|
647 date = newdate date
|
|
648 }
|
15911
|
649 time = substr($3, 1, length($3) - 1)
|
527
|
650 author = substr($5, 1, length($5)-1)
|
39150
|
651 printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH
|
15911
|
652 rev = "?"
|
527
|
653 next
|
|
654 }
|
18452
|
655 if (line ~ /^branches: /) { next }
|
|
656 if (line ~ /^(-----------*|===========*)$/) { print ""; next }
|
|
657 if (line == "Initial revision" || line ~ /^file .+ was initially added on branch .+\.$/) {
|
|
658 line = "New file."
|
|
659 }
|
39150
|
660 printf "%s%s", line, SOH
|
527
|
661 }
|
39150
|
662 ' <"$rlogfile" |
|
527
|
663
|
|
664 # Now each line is of the form
|
39150
|
665 # FILENAME@REVISION@YYYY-MM-DD@HH:MM:SS[+-TIMEZONE]@AUTHOR@LOG
|
|
666 # where @ stands for an SOH (octal code 001),
|
|
667 # and each line of LOG is terminated by SOH instead of \n.
|
640
|
668 # Sort the log entries, first by date+time (in reverse order),
|
15911
|
669 # then by author, then by log entry, and finally by file name and revision
|
|
670 # (just in case).
|
43097
|
671 sort -t"$SOH" $SORT_K_OPTIONS |
|
527
|
672
|
|
673 # Finally, reformat the sorted log entries.
|
39150
|
674 $AWK -F"$SOH" '
|
527
|
675 BEGIN {
|
15911
|
676 logTZ = "'"$logTZ"'"
|
|
677 revision = "'"$revision"'"
|
|
678
|
4783
|
679 # Initialize the fullname and mailaddr associative arrays.
|
527
|
680 '"$initialize_fullname"'
|
4783
|
681 '"$initialize_mailaddr"'
|
527
|
682
|
534
|
683 # Initialize indent string.
|
|
684 indent_string = ""
|
|
685 i = '"$indent"'
|
|
686 if (0 < '"$tabwidth"')
|
|
687 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
|
|
688 indent_string = indent_string "\t"
|
|
689 while (1 <= i--)
|
|
690 indent_string = indent_string " "
|
527
|
691 }
|
636
|
692
|
527
|
693 {
|
39150
|
694 newlog = ""
|
|
695 for (i = 6; i < NF; i++) newlog = newlog $i "\n"
|
636
|
696
|
|
697 # Ignore log entries prefixed by "#".
|
|
698 if (newlog ~ /^#/) { next }
|
|
699
|
15911
|
700 if (Log != newlog || date != $3 || author != $5) {
|
594
|
701
|
527
|
702 # The previous log and this log differ.
|
594
|
703
|
|
704 # Print the old log.
|
527
|
705 if (date != "") '"$printlogline"'
|
|
706
|
594
|
707 # Logs that begin with "{clumpname} " should be grouped together,
|
|
708 # and the clumpname should be removed.
|
|
709 # Extract the new clumpname from the log header,
|
|
710 # and use it to decide whether to output a blank line.
|
|
711 newclumpname = ""
|
|
712 sep = "\n"
|
602
d2de231ee7f5
Don't duplicate most recent logs. Fix bug in dates after Feb 29 in leap year.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
713 if (date == "") sep = ""
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
714 if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) {
|
594
|
715 i = index(newlog, "}")
|
|
716 newclumpname = substr(newlog, 1, i)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
717 while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++
|
594
|
718 newlog = substr(newlog, i+1)
|
41649
|
719 if (clumpname == newclumpname && date == $3 && author == $5) sep = ""
|
594
|
720 }
|
|
721 printf sep
|
|
722 clumpname = newclumpname
|
|
723
|
527
|
724 # Get ready for the next log.
|
|
725 Log = newlog
|
534
|
726 if (files != "")
|
|
727 for (i in filesknown)
|
|
728 filesknown[i] = 0
|
527
|
729 files = ""
|
|
730 }
|
15911
|
731 if (date != $3 || author != $5) {
|
527
|
732 # The previous date+author and this date+author differ.
|
|
733 # Print the new one.
|
15911
|
734 date = $3
|
|
735 time = $4
|
|
736 author = $5
|
527
|
737
|
15911
|
738 zone = ""
|
|
739 if (logTZ && ((i = index(time, "-")) || (i = index(time, "+"))))
|
|
740 zone = " " substr(time, i)
|
527
|
741
|
15911
|
742 # Print "date[ timezone] fullname <email address>".
|
4783
|
743 # Get fullname and email address from associative arrays;
|
|
744 # default to author and author@hostname if not in arrays.
|
534
|
745 if (fullname[author])
|
4783
|
746 auth = fullname[author]
|
534
|
747 else
|
4783
|
748 auth = author
|
15911
|
749 printf "%s%s %s ", date, zone, auth
|
4783
|
750 if (mailaddr[author])
|
8496
|
751 printf "<%s>\n\n", mailaddr[author]
|
4783
|
752 else
|
8496
|
753 printf "<%s@%s>\n\n", author, "'"$hostname"'"
|
527
|
754 }
|
534
|
755 if (! filesknown[$1]) {
|
|
756 filesknown[$1] = 1
|
594
|
757 if (files == "") files = " " $1
|
|
758 else files = files ", " $1
|
15911
|
759 if (revision && $2 != "?") files = files " " $2
|
534
|
760 }
|
527
|
761 }
|
|
762 END {
|
|
763 # Print the last log.
|
594
|
764 if (date != "") {
|
|
765 '"$printlogline"'
|
|
766 printf "\n"
|
|
767 }
|
527
|
768 }
|
|
769 ' &&
|
|
770
|
|
771
|
|
772 # Exit successfully.
|
|
773
|
35016
|
774 exec rm -fr $logdir
|
15911
|
775
|
|
776 # Local Variables:
|
|
777 # tab-width:4
|
|
778 # End:
|
52401
|
779
|
|
780 # arch-tag: cea067bd-a552-4254-ba17-078208933073
|