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