12507
|
1 #! /bin/sh
|
527
|
2
|
|
3 # RCS to ChangeLog generator
|
|
4
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
5 # Generate a change log prefix from RCS files (perhaps in the CVS repository)
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
6 # and the ChangeLog (if any).
|
527
|
7 # Output the new prefix to standard output.
|
|
8 # You can edit this prefix by hand, and then prepend it to ChangeLog.
|
|
9
|
636
|
10 # Ignore log entries that start with `#'.
|
|
11 # Clump together log entries that start with `{topic} ',
|
|
12 # where `topic' contains neither white space nor `}'.
|
527
|
13
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
14 Help='The default FILEs are the files registered under the working directory.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
15 Options:
|
1800
|
16
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
17 -c CHANGELOG Output a change log prefix to CHANGELOG (default ChangeLog).
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
18 -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
|
19 -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
|
20 -l LENGTH Try to limit log lines to LENGTH characters (default 79).
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
21 -R If no FILEs are given and RCS is used, recurse through working directory.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
22 -r OPTION Pass OPTION to subsidiary log command.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
23 -t TABWIDTH Tab stops are every TABWIDTH characters (default 8).
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
24 -u "LOGIN<tab>FULLNAME<tab>MAILADDR" Assume LOGIN has FULLNAME and MAILADDR.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
25 -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
|
26 --help Output help.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
27 --version Output version number.
|
1800
|
28
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
29 Report bugs to <bug-gnu-emacs@prep.ai.mit.edu>.'
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
30
|
17791
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
31 Id='$Id: rcs2log,v 1.40 1997/05/11 20:02:32 eggert Exp eggert $'
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
32
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
33 # Copyright 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
1800
|
34
|
|
35 # This program is free software; you can redistribute it and/or modify
|
|
36 # it under the terms of the GNU General Public License as published by
|
|
37 # the Free Software Foundation; either version 2, or (at your option)
|
|
38 # any later version.
|
15911
|
39 #
|
1800
|
40 # This program is distributed in the hope that it will be useful,
|
|
41 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
42 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
43 # GNU General Public License for more details.
|
15911
|
44 #
|
1800
|
45 # You should have received a copy of the GNU General Public License
|
15937
ab395798ed22
Change `GNU Emacs' to `this program' in the comment referring the reader
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
46 # along with this program; see the file COPYING. If not, write to the
|
15742
|
47 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
48 # Boston, MA 02111-1307, USA.
|
1800
|
49
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
50 Copyright='Copyright 1997 Free Software Foundation, Inc.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
51 This program comes with NO WARRANTY, to the extent permitted by law.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
52 You may redistribute copies of this program
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
53 under the terms of the GNU General Public License.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
54 For more information about these matters, see the files named COPYING.
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
55 Author: Paul Eggert <eggert@twinsun.com>'
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
56
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
57 tab=' '
|
3248
|
58 nl='
|
|
59 '
|
1800
|
60
|
534
|
61 # Parse options.
|
|
62
|
|
63 # defaults
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
64 : ${AWK=awk}
|
4783
|
65 : ${TMPDIR=/tmp}
|
15911
|
66 changelog=ChangeLog # change log file name
|
|
67 datearg= # rlog date option
|
4783
|
68 hostname= # name of local host (if empty, will deduce it later)
|
534
|
69 indent=8 # indent of log line
|
|
70 length=79 # suggested max width of log line
|
11627
|
71 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
|
72 loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets
|
15911
|
73 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
|
74 recursive= # t if we want recursive rlog
|
15911
|
75 revision= # t if we want revision numbers
|
4783
|
76 rlog_options= # options to pass to rlog
|
534
|
77 tabwidth=8 # width of horizontal tab
|
|
78
|
|
79 while :
|
|
80 do
|
|
81 case $1 in
|
15911
|
82 -c) changelog=${2?}; shift;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
83 -i) indent=${2?}; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
84 -h) hostname=${2?}; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
85 -l) length=${2?}; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
86 -[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
|
87 case $1 in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
88 -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
|
89 *"$tab"* | *"$nl"*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
90 echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
91 exit 1
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
92 esac
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
93 case $loginFullnameMailaddrs in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
94 '') loginFullnameMailaddrs=$2$tab$3$tab$4;;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
95 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
96 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
97 shift; shift; shift;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
98 -u)
|
11082
|
99 # 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
|
100 case ${2?} in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
101 *"$nl"*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
102 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
|
103 exit 1;;
|
11082
|
104 *"$tab"*)
|
|
105 t=$tab;;
|
|
106 *)
|
|
107 t=:
|
|
108 esac
|
|
109 case $2 in
|
|
110 *"$t"*"$t"*"$t"*)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
111 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
|
112 exit 1;;
|
11082
|
113 *"$t"*"$t"*)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
114 ;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
115 *)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
116 echo >&2 "$0: -u '$2': not enough fields"
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
117 exit 1
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
118 esac
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
119 case $loginFullnameMailaddrs in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
120 '') loginFullnameMailaddrs=$2;;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
121 ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
122 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
123 shift
|
4783
|
124 esac
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
125 case $logins in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
126 '') logins=$login;;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
127 ?*) logins=$logins$nl$login
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
128 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
129 ;;
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
130 -r)
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
131 case $rlog_options in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
132 '') rlog_options=${2?};;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
133 ?*) rlog_options=$rlog_options$nl${2?}
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
134 esac
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
135 shift;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
136 -R) recursive=t;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
137 -t) tabwidth=${2?}; shift;;
|
15911
|
138 -v) revision=t;;
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
139 --version)
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
140 set $Id
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
141 rcs2logVersion=$3
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
142 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
|
143 exit 0;;
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
144 -*) 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
|
145 case $1 in
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
146 --help) exit 0;;
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
147 *) exit 1
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
148 esac;;
|
534
|
149 *) break
|
|
150 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
151 shift
|
534
|
152 done
|
|
153
|
2220
|
154 month_data='
|
|
155 m[0]="Jan"; m[1]="Feb"; m[2]="Mar"
|
|
156 m[3]="Apr"; m[4]="May"; m[5]="Jun"
|
|
157 m[6]="Jul"; m[7]="Aug"; m[8]="Sep"
|
|
158 m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
|
|
159 '
|
|
160
|
534
|
161
|
11627
|
162 # Put rlog output into $rlogout.
|
527
|
163
|
11627
|
164 # If no rlog options are given,
|
|
165 # log the revisions checked in since the first ChangeLog entry.
|
15911
|
166 # Since ChangeLog is only by date, some of these revisions may be duplicates of
|
|
167 # what's already in ChangeLog; it's the user's responsibility to remove them.
|
11627
|
168 case $rlog_options in
|
|
169 '')
|
15911
|
170 if test -s "$changelog"
|
11627
|
171 then
|
|
172 e='
|
15911
|
173 /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{
|
|
174 # ISO 8601 date
|
|
175 print $1
|
|
176 exit
|
|
177 }
|
11627
|
178 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
|
15911
|
179 # old-fashioned date and time (Emacs 19.31 and earlier)
|
11627
|
180 '"$month_data"'
|
|
181 year = $5
|
|
182 for (i=0; i<=11; i++) if (m[i] == $2) break
|
|
183 dd = $3
|
15911
|
184 printf "%d-%02d-%02d\n", year, i+1, dd
|
11627
|
185 exit
|
2220
|
186 }
|
11627
|
187 '
|
15911
|
188 d=`$AWK "$e" <"$changelog"` || exit
|
11627
|
189 case $d in
|
16438
30536ab085c7
(datearg): Use the empty string, not '-d>1970-01-01', to extract all
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
190 ?*) datearg="-d>$d"
|
11627
|
191 esac
|
|
192 fi
|
|
193 esac
|
527
|
194
|
15911
|
195 # Use TZ specified by ChangeLog local variable, if any.
|
|
196 if test -s "$changelog"
|
|
197 then
|
|
198 extractTZ='
|
|
199 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{
|
|
200 s//\1/; p; q
|
|
201 }
|
|
202 /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{
|
|
203 s//UTC0/; p; q
|
|
204 }
|
|
205 '
|
|
206 logTZ=`tail "$changelog" | sed -n "$extractTZ"`
|
|
207 case $logTZ in
|
|
208 ?*) TZ=$logTZ; export TZ
|
|
209 esac
|
|
210 fi
|
|
211
|
11627
|
212 # If CVS is in use, examine its repository, not the normal RCS files.
|
|
213 if test ! -f CVS/Repository
|
|
214 then
|
|
215 rlog=rlog
|
|
216 repository=
|
|
217 else
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
218 rlog='cvs -q log'
|
11627
|
219 repository=`sed 1q <CVS/Repository` || exit
|
12408
|
220 test ! -f CVS/Root || CVSROOT=`cat <CVS/Root` || exit
|
12509
|
221 case $CVSROOT in
|
12408
|
222 *:/*)
|
|
223 # remote repository
|
|
224 ;;
|
|
225 *)
|
|
226 # local repository
|
|
227 case $repository in
|
|
228 /*) ;;
|
12509
|
229 *) repository=${CVSROOT?}/$repository
|
12408
|
230 esac
|
|
231 if test ! -d "$repository"
|
|
232 then
|
|
233 echo >&2 "$0: $repository: bad repository (see CVS/Repository)"
|
|
234 exit 1
|
|
235 fi
|
11627
|
236 esac
|
|
237 fi
|
8549
|
238
|
16332
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
239 # Use $rlog's -zLT option, if $rlog supports it.
|
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
240 case `$rlog -zLT 2>&1` in
|
16433
63dc01de1823
(rlog_options): Look for ' option' rather than 'unknown option',
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
241 *' option'*) ;;
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
242 *)
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
243 case $rlog_options in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
244 '') rlog_options=-zLT;;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
245 ?*) rlog_options=-zLT$nl$rlog_options
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
246 esac
|
16332
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
247 esac
|
be25bd9150e8
(rlog_options): Use $rlog, not rlog, when deciding whether to append -zLT.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
248
|
3248
|
249 # With no arguments, examine all files under the RCS directory.
|
|
250 case $# in
|
|
251 0)
|
8549
|
252 case $repository in
|
|
253 '')
|
|
254 oldIFS=$IFS
|
|
255 IFS=$nl
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
256 case $recursive in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
257 t)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
258 RCSdirs=`find . -name RCS -type d -print`
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
259 filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||'
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
260 files=`
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
261 {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
262 case $RCSdirs in
|
17202
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
263 ?*) find $RCSdirs \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
264 -type f \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
265 ! -name '*_' \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
266 ! -name ',*,' \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
267 ! -name '.*_' \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
268 ! -name .rcsfreeze.log \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
269 ! -name .rcsfreeze.ver \
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
270 -print
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
271 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
272 find . -name '*,v' -print
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
273 } |
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
274 sort -u |
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
275 sed "$filesFromRCSfiles"
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
276 `;;
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
277 *)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
278 files=
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
279 for file in RCS/.* RCS/* .*,v *,v
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
280 do
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
281 case $file in
|
17202
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
282 RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;;
|
9555c074333c
(files): Ignore files in RCS directory whose names are of the form ,*,
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
283 RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;;
|
17791
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
284 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;;
|
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
285 RCS/*,v | RCS/.*,v) ;;
|
c113f8bd706c
(files): When computing arguments automatically, ignore non-files
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
286 RCS/* | RCS/.*) test -f "$file" || continue
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
287 esac
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
288 case $files in
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
289 '') files=$file;;
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
290 ?*) files=$files$nl$file
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
291 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
292 done
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
293 case $files in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
294 '') exit 0
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
295 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
296 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
297 set x $files
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
298 shift
|
8549
|
299 IFS=$oldIFS
|
3248
|
300 esac
|
|
301 esac
|
|
302
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
303 llogout=$TMPDIR/rcs2log$$l
|
4783
|
304 rlogout=$TMPDIR/rcs2log$$r
|
527
|
305 trap exit 1 2 13 15
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
306 trap "rm -f $llogout $rlogout; exit 1" 0
|
527
|
307
|
15911
|
308 case $datearg in
|
|
309 ?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;;
|
|
310 '') $rlog $rlog_options ${1+"$@"} >$rlogout
|
11627
|
311 esac || exit
|
527
|
312
|
|
313
|
|
314 # Get the full name of each author the logs mention, and set initialize_fullname
|
|
315 # to awk code that initializes the `fullname' awk associative array.
|
|
316 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
|
|
317 # you have to fix the resulting output by hand.
|
|
318
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
319 initialize_fullname=
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
320 initialize_mailaddr=
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
321
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
322 case $loginFullnameMailaddrs in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
323 ?*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
324 case $loginFullnameMailaddrs in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
325 *\"* | *\\*)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
326 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
|
327 $loginFullnameMailaddrs
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
328 EOF
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
329 loginFullnameMailaddrs=`cat $llogout`
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
330 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
331
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
332 oldIFS=$IFS
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
333 IFS=$nl
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
334 for loginFullnameMailaddr in $loginFullnameMailaddrs
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
335 do
|
11082
|
336 case $loginFullnameMailaddr in
|
|
337 *"$tab"*) IFS=$tab;;
|
|
338 *) IFS=:
|
|
339 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
340 set x $loginFullnameMailaddr
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
341 login=$2
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
342 fullname=$3
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
343 mailaddr=$4
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
344 initialize_fullname="$initialize_fullname
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
345 fullname[\"$login\"] = \"$fullname\""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
346 initialize_mailaddr="$initialize_mailaddr
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
347 mailaddr[\"$login\"] = \"$mailaddr\""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
348 done
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
349 IFS=$oldIFS
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
350 esac
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
351
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
352 case $llogout in
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
353 ?*) sort -u -o $llogout <<EOF || exit
|
4783
|
354 $logins
|
|
355 EOF
|
|
356 esac
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
361 }'
|
527
|
362 authors=`
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
363 $AWK "$output_authors" <$rlogout |
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
364 case $llogout in
|
4783
|
365 '') sort -u;;
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
366 ?*) sort -u | comm -23 - $llogout
|
4783
|
367 esac
|
527
|
368 `
|
640
|
369 case $authors in
|
|
370 ?*)
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
371 cat >$llogout <<EOF || exit
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
372 $authors
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
373 EOF
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
374 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
|
375 initialize_author=`sed -e "$initialize_author_script" <$llogout`
|
640
|
376 awkscript='
|
|
377 BEGIN {
|
|
378 alphabet = "abcdefghijklmnopqrstuvwxyz"
|
|
379 ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
380 '"$initialize_author"'
|
|
381 }
|
|
382 {
|
|
383 if (author[$1]) {
|
|
384 fullname = $5
|
4504
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
385 if (fullname ~ /[0-9]+-[^(]*\([0-9]+\)$/) {
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
386 # 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
|
387 fullname = substr(fullname, index(fullname, "-") + 1)
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
388 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
|
389 }
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
390 if (fullname ~ /,[^ ]/) {
|
65ef94a9e2c4
(awkscript): Some sites put comma-separated junk after the fullname.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
391 # 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
|
392 # 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
|
393 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
|
394 }
|
640
|
395 abbr = index(fullname, "&")
|
|
396 if (abbr) {
|
|
397 a = substr($1, 1, 1)
|
|
398 A = a
|
|
399 i = index(alphabet, a)
|
|
400 if (i) A = substr(ALPHABET, i, 1)
|
|
401 fullname = substr(fullname, 1, abbr-1) A substr($1, 2) substr(fullname, abbr+1)
|
|
402 }
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
403
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
404 # 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
|
405 # 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
|
406 quoted = ""
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
407 rest = fullname
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
408 for (;;) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
409 p = index(rest, "\\")
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
410 q = index(rest, "\"")
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
411 if (p) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
412 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
|
413 } else {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
414 if (!q) break
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
415 p = q
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
416 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
417 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
|
418 rest = substr(rest, p+1)
|
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
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
421 printf "fullname[\"%s\"] = \"%s%s\"\n", $1, quoted, rest
|
640
|
422 author[$1] = 0
|
|
423 }
|
|
424 }
|
|
425 '
|
|
426
|
|
427 initialize_fullname=`
|
14173
|
428 (
|
|
429 cat /etc/passwd
|
|
430 for author in $authors
|
17233
a40eff0f724c
(initialize_fullname): Set NIS_PATH to the empty string before invoking
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
431 do NIS_PATH= nismatch $author passwd.org_dir
|
14173
|
432 done
|
|
433 ypmatch $authors passwd
|
|
434 ) 2>/dev/null |
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
435 $AWK -F: "$awkscript"
|
4783
|
436 `$initialize_fullname
|
640
|
437 esac
|
527
|
438
|
|
439
|
|
440 # Function to print a single log line.
|
|
441 # We don't use awk functions, to stay compatible with old awk versions.
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
442 # `Log' is the log message (with \n replaced by \001).
|
594
|
443 # `files' contains the affected files.
|
527
|
444 printlogline='{
|
|
445
|
|
446 # Following the GNU coding standards, rewrite
|
|
447 # * file: (function): comment
|
|
448 # to
|
|
449 # * file (function): comment
|
|
450 if (Log ~ /^\([^)]*\): /) {
|
|
451 i = index(Log, ")")
|
|
452 files = files " " substr(Log, 1, i)
|
|
453 Log = substr(Log, i+3)
|
|
454 }
|
|
455
|
|
456 # If "label: comment" is too long, break the line after the ":".
|
|
457 sep = " "
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
458 if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, SOH)) sep = "\n" indent_string
|
527
|
459
|
|
460 # Print the label.
|
534
|
461 printf "%s*%s:", indent_string, files
|
527
|
462
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
463 # Print each line of the log, transliterating \001 to \n.
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
464 while ((i = index(Log, SOH)) != 0) {
|
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
465 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
|
466 if (logline ~ /[^'"$tab"' ]/) {
|
4858
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
467 printf "%s%s\n", sep, logline
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
468 } else {
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
469 print ""
|
5b4f9564bfaf
(printlogline): Don't generate lines containing only white space.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
470 }
|
534
|
471 sep = indent_string
|
527
|
472 Log = substr(Log, i+1)
|
|
473 }
|
|
474 }'
|
|
475
|
15911
|
476 # Pattern to match the `revision' line of rlog output.
|
|
477 rlog_revision_pattern='^revision [0-9]+\.[0-9]+(\.[0-9]+\.[0-9]+)*(['"$tab"' ]+locked by: [^'"$tab"' $,.0-9:;@]*[^'"$tab"' $,:;@][^'"$tab"' $,.0-9:;@]*;)?['"$tab"' ]*$'
|
|
478
|
4783
|
479 case $hostname in
|
|
480 '')
|
|
481 hostname=`(
|
|
482 hostname || uname -n || uuname -l || cat /etc/whoami
|
|
483 ) 2>/dev/null` || {
|
|
484 echo >&2 "$0: cannot deduce hostname"
|
|
485 exit 1
|
|
486 }
|
14173
|
487
|
|
488 case $hostname in
|
|
489 *.*) ;;
|
|
490 *)
|
|
491 domainname=`(domainname) 2>/dev/null` &&
|
|
492 case $domainname in
|
|
493 *.*) hostname=$hostname.$domainname
|
|
494 esac
|
|
495 esac
|
4783
|
496 esac
|
527
|
497
|
|
498
|
|
499 # Process the rlog output, generating ChangeLog style entries.
|
|
500
|
|
501 # First, reformat the rlog output so that each line contains one log entry.
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
502 # Transliterate \n to \001 so that multiline entries fit on a single line.
|
527
|
503 # Discard irrelevant rlog output.
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
504 $AWK <$rlogout '
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
505 BEGIN { repository = "'"$repository"'" }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
506 /^RCS file:/ {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
507 if (repository != "") {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
508 filename = $3
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
509 if (substr(filename, 1, length(repository) + 1) == repository "/") {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
510 filename = substr(filename, length(repository) + 2)
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
511 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
512 if (filename ~ /,v$/) {
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
513 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
|
514 }
|
16507
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
515 if (filename ~ /(^|\/)Attic\/[^\/]*$/) {
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
516 i = length(filename)
|
08855b88e955
When processing cvs log output, remove `Attic/' from repository file names.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
517 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
|
518 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
|
519 }
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
520 }
|
15911
|
521 rev = "?"
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
522 }
|
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
523 /^Working file:/ { if (repository == "") filename = $3 }
|
15911
|
524 /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ {
|
|
525 if ($0 ~ /'"$rlog_revision_pattern"'/) {
|
|
526 rev = $2
|
|
527 next
|
|
528 }
|
8549
|
529 if ($0 ~ /^date: [0-9][- +\/0-9:]*;/) {
|
|
530 date = $2
|
15911
|
531 if (date ~ /\//) {
|
|
532 # This is a traditional RCS format date YYYY/MM/DD.
|
|
533 # Replace "/"s with "-"s to get ISO format.
|
8549
|
534 newdate = ""
|
15911
|
535 while ((i = index(date, "/")) != 0) {
|
|
536 newdate = newdate substr(date, 1, i-1) "-"
|
8549
|
537 date = substr(date, i+1)
|
|
538 }
|
|
539 date = newdate date
|
|
540 }
|
15911
|
541 time = substr($3, 1, length($3) - 1)
|
527
|
542 author = substr($5, 1, length($5)-1)
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
543 printf "%s %s %s %s %s %c", filename, rev, date, time, author, 1
|
15911
|
544 rev = "?"
|
527
|
545 next
|
|
546 }
|
15911
|
547 if ($0 ~ /^branches: /) { next }
|
636
|
548 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next }
|
16899
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
549 if ($0 == "Initial revision" || $0 ~ /^file .+ was initially added on branch .+\.$/) {
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
550 $0 = "New file."
|
04ad9edd12b3
--help, --version: New options, for conformance to GNU coding standards.
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
551 }
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
552 printf "%s%c", $0, 1
|
527
|
553 }
|
|
554 ' |
|
|
555
|
|
556 # Now each line is of the form
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
557 # FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \001LOG
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
558 # where \001 stands for a carriage return,
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
559 # and each line of the log is terminated by \001 instead of \n.
|
640
|
560 # Sort the log entries, first by date+time (in reverse order),
|
15911
|
561 # then by author, then by log entry, and finally by file name and revision
|
|
562 # (just in case).
|
|
563 sort +2 -4r +4 +0 |
|
527
|
564
|
|
565 # Finally, reformat the sorted log entries.
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
566 $AWK '
|
527
|
567 BEGIN {
|
15911
|
568 logTZ = "'"$logTZ"'"
|
|
569 revision = "'"$revision"'"
|
|
570
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
571 # Some awk variants do not understand "\001", so we have to
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
572 # put the char directly in the file.
|
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
573 SOH="" # <-- There is a single SOH (octal code 001) here.
|
527
|
574
|
4783
|
575 # Initialize the fullname and mailaddr associative arrays.
|
527
|
576 '"$initialize_fullname"'
|
4783
|
577 '"$initialize_mailaddr"'
|
527
|
578
|
534
|
579 # Initialize indent string.
|
|
580 indent_string = ""
|
|
581 i = '"$indent"'
|
|
582 if (0 < '"$tabwidth"')
|
|
583 for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
|
|
584 indent_string = indent_string "\t"
|
|
585 while (1 <= i--)
|
|
586 indent_string = indent_string " "
|
527
|
587 }
|
636
|
588
|
527
|
589 {
|
17741
0c832661d9b4
(loginFullnameMailaddrs, logins, rlog_options, files): Don't prepend $nl
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
590 newlog = substr($0, 1 + index($0, SOH))
|
636
|
591
|
|
592 # Ignore log entries prefixed by "#".
|
|
593 if (newlog ~ /^#/) { next }
|
|
594
|
15911
|
595 if (Log != newlog || date != $3 || author != $5) {
|
594
|
596
|
527
|
597 # The previous log and this log differ.
|
594
|
598
|
|
599 # Print the old log.
|
527
|
600 if (date != "") '"$printlogline"'
|
|
601
|
594
|
602 # Logs that begin with "{clumpname} " should be grouped together,
|
|
603 # and the clumpname should be removed.
|
|
604 # Extract the new clumpname from the log header,
|
|
605 # and use it to decide whether to output a blank line.
|
|
606 newclumpname = ""
|
|
607 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
|
608 if (date == "") sep = ""
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
609 if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) {
|
594
|
610 i = index(newlog, "}")
|
|
611 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
|
612 while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++
|
594
|
613 newlog = substr(newlog, i+1)
|
|
614 if (clumpname == newclumpname) sep = ""
|
|
615 }
|
|
616 printf sep
|
|
617 clumpname = newclumpname
|
|
618
|
527
|
619 # Get ready for the next log.
|
|
620 Log = newlog
|
534
|
621 if (files != "")
|
|
622 for (i in filesknown)
|
|
623 filesknown[i] = 0
|
527
|
624 files = ""
|
|
625 }
|
15911
|
626 if (date != $3 || author != $5) {
|
527
|
627 # The previous date+author and this date+author differ.
|
|
628 # Print the new one.
|
15911
|
629 date = $3
|
|
630 time = $4
|
|
631 author = $5
|
527
|
632
|
15911
|
633 zone = ""
|
|
634 if (logTZ && ((i = index(time, "-")) || (i = index(time, "+"))))
|
|
635 zone = " " substr(time, i)
|
527
|
636
|
15911
|
637 # Print "date[ timezone] fullname <email address>".
|
4783
|
638 # Get fullname and email address from associative arrays;
|
|
639 # default to author and author@hostname if not in arrays.
|
534
|
640 if (fullname[author])
|
4783
|
641 auth = fullname[author]
|
534
|
642 else
|
4783
|
643 auth = author
|
15911
|
644 printf "%s%s %s ", date, zone, auth
|
4783
|
645 if (mailaddr[author])
|
8496
|
646 printf "<%s>\n\n", mailaddr[author]
|
4783
|
647 else
|
8496
|
648 printf "<%s@%s>\n\n", author, "'"$hostname"'"
|
527
|
649 }
|
534
|
650 if (! filesknown[$1]) {
|
|
651 filesknown[$1] = 1
|
594
|
652 if (files == "") files = " " $1
|
|
653 else files = files ", " $1
|
15911
|
654 if (revision && $2 != "?") files = files " " $2
|
534
|
655 }
|
527
|
656 }
|
|
657 END {
|
|
658 # Print the last log.
|
594
|
659 if (date != "") {
|
|
660 '"$printlogline"'
|
|
661 printf "\n"
|
|
662 }
|
527
|
663 }
|
|
664 ' &&
|
|
665
|
|
666
|
|
667 # Exit successfully.
|
|
668
|
11073
554c86f77db0
Add -u "login<tab>fullname<tab>mailaddr" option, which replaces the
Paul Eggert <eggert@twinsun.com>
diff
changeset
|
669 exec rm -f $llogout $rlogout
|
15911
|
670
|
|
671 # Local Variables:
|
|
672 # tab-width:4
|
|
673 # End:
|