Mercurial > emacs
comparison lib-src/rcs2log @ 11627:2f0766bf8315
(datearg): If rlog options are specified explicitly,
omit the implicit '-d>DATE' option.
(repository, rlog): Allow absolute paths to CVS repositories.
Look only at the first line of CVS/Repository.
author | Paul Eggert <eggert@twinsun.com> |
---|---|
date | Sun, 30 Apr 1995 15:34:52 +0000 |
parents | 4d05376b5cb2 |
children | b9b0b3f96dc2 |
comparison
equal
deleted
inserted
replaced
11626:0b86aef0c387 | 11627:2f0766bf8315 |
---|---|
10 # Clump together log entries that start with `{topic} ', | 10 # Clump together log entries that start with `{topic} ', |
11 # where `topic' contains neither white space nor `}'. | 11 # where `topic' contains neither white space nor `}'. |
12 | 12 |
13 # Author: Paul Eggert <eggert@twinsun.com> | 13 # Author: Paul Eggert <eggert@twinsun.com> |
14 | 14 |
15 # $Id: rcs2log,v 1.20 1995/03/21 23:14:41 eggert Exp eggert $ | 15 # $Id: rcs2log,v 1.22 1995/04/30 15:34:52 eggert Exp $ |
16 | 16 |
17 # Copyright 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | 17 # Copyright 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
18 | 18 |
19 # This program is free software; you can redistribute it and/or modify | 19 # This program is free software; you can redistribute it and/or modify |
20 # it under the terms of the GNU General Public License as published by | 20 # it under the terms of the GNU General Public License as published by |
40 : ${AWK=awk} | 40 : ${AWK=awk} |
41 : ${TMPDIR=/tmp} | 41 : ${TMPDIR=/tmp} |
42 hostname= # name of local host (if empty, will deduce it later) | 42 hostname= # name of local host (if empty, will deduce it later) |
43 indent=8 # indent of log line | 43 indent=8 # indent of log line |
44 length=79 # suggested max width of log line | 44 length=79 # suggested max width of log line |
45 logins= # login names for people we know fullnames and mailaddresses of | 45 logins= # login names for people we know fullnames and mailaddrs of |
46 loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets | 46 loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets |
47 recursive= # t if we want recursive rlog | 47 recursive= # t if we want recursive rlog |
48 rlog_options= # options to pass to rlog | 48 rlog_options= # options to pass to rlog |
49 tabwidth=8 # width of horizontal tab | 49 tabwidth=8 # width of horizontal tab |
50 | 50 |
114 mo[8]=243; mo[9]=273; mo[10]=304; mo[11]=334 | 114 mo[8]=243; mo[9]=273; mo[10]=304; mo[11]=334 |
115 mo[12]=365 | 115 mo[12]=365 |
116 ' | 116 ' |
117 | 117 |
118 | 118 |
119 # Log into $rlogout the revisions checked in since the first ChangeLog entry. | 119 # Put rlog output into $rlogout. |
120 | 120 |
121 date=1970 | 121 # If no rlog options are given, |
122 if test -s ChangeLog | 122 # log the revisions checked in since the first ChangeLog entry. |
123 then | 123 case $rlog_options in |
124 # Add 1 to seconds to avoid duplicating most recent log. | 124 '') |
125 e=' | 125 date=1970 |
126 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ | 126 if test -s ChangeLog |
127 '"$month_data"' | 127 then |
128 year = $5 | 128 # Add 1 to seconds to avoid duplicating most recent log. |
129 for (i=0; i<=11; i++) if (m[i] == $2) break | 129 e=' |
130 dd = $3 | 130 /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ |
131 hh = substr($0,12,2) | 131 '"$month_data"' |
132 mm = substr($0,15,2) | 132 year = $5 |
133 ss = substr($0,18,2) | 133 for (i=0; i<=11; i++) if (m[i] == $2) break |
134 ss++ | 134 dd = $3 |
135 if (ss == 60) { | 135 hh = substr($0,12,2) |
136 ss = 0 | 136 mm = substr($0,15,2) |
137 mm++ | 137 ss = substr($0,18,2) |
138 if (mm == 60) { | 138 ss++ |
139 mm = 0 | 139 if (ss == 60) { |
140 hh++ | 140 ss = 0 |
141 if (hh == 24) { | 141 mm++ |
142 hh = 0 | 142 if (mm == 60) { |
143 dd++ | 143 mm = 0 |
144 monthdays = mo[i+1] - mo[i] | 144 hh++ |
145 if (i == 1 && year%4 == 0 && (year%100 != 0 || year%400 == 0)) monthdays++ | 145 if (hh == 24) { |
146 if (dd == monthdays + 1) { | 146 hh = 0 |
147 dd = 1 | 147 dd++ |
148 i++ | 148 monthdays = mo[i+1] - mo[i] |
149 if (i == 12) { | 149 if (i == 1 && year%4 == 0 && (year%100 != 0 || year%400 == 0)) monthdays++ |
150 i = 0 | 150 if (dd == monthdays + 1) { |
151 year++ | 151 dd = 1 |
152 i++ | |
153 if (i == 12) { | |
154 i = 0 | |
155 year++ | |
156 } | |
152 } | 157 } |
153 } | 158 } |
154 } | 159 } |
155 } | 160 } |
161 printf "%d/%02d/%02d %02d:%02d:%02d\n", year,i+1,dd,hh,mm,ss | |
162 exit | |
156 } | 163 } |
157 printf "%d/%02d/%02d %02d:%02d:%02d\n", year, i+1, dd, hh, mm, ss | 164 ' |
158 exit | 165 d=`$AWK "$e" <ChangeLog` || exit |
159 } | 166 case $d in |
160 ' | 167 ?*) date=$d |
161 d=`$AWK "$e" <ChangeLog` || exit | 168 esac |
162 case $d in | 169 fi |
163 ?*) date=$d | 170 datearg="-d>$date" |
171 esac | |
172 | |
173 # If CVS is in use, examine its repository, not the normal RCS files. | |
174 if test ! -f CVS/Repository | |
175 then | |
176 rlog=rlog | |
177 repository= | |
178 else | |
179 rlog='cvs log' | |
180 repository=`sed 1q <CVS/Repository` || exit | |
181 case $repository in | |
182 /*) ;; | |
183 *) repository=${CVSROOT?}/$repository | |
164 esac | 184 esac |
185 if test ! -d "$repository" | |
186 then | |
187 echo >&2 "$0: $repository: bad repository (see CVS/Repository)" | |
188 exit 1 | |
189 fi | |
165 fi | 190 fi |
166 datearg="-d>$date" | |
167 | |
168 repository= | |
169 rlog=rlog | |
170 case $CVSROOT in | |
171 ?*) | |
172 if test -d "$CVSROOT" && test -f CVS/Repository | |
173 then | |
174 r=`cat <CVS/Repository` || exit | |
175 if test -d "$CVSROOT/$r" | |
176 then | |
177 repository=$CVSROOT/$r | |
178 rlog='cvs log' | |
179 fi | |
180 fi | |
181 esac | |
182 | 191 |
183 # With no arguments, examine all files under the RCS directory. | 192 # With no arguments, examine all files under the RCS directory. |
184 case $# in | 193 case $# in |
185 0) | 194 0) |
186 case $repository in | 195 case $repository in |
224 llogout=$TMPDIR/rcs2log$$l | 233 llogout=$TMPDIR/rcs2log$$l |
225 rlogout=$TMPDIR/rcs2log$$r | 234 rlogout=$TMPDIR/rcs2log$$r |
226 trap exit 1 2 13 15 | 235 trap exit 1 2 13 15 |
227 trap "rm -f $llogout $rlogout; exit 1" 0 | 236 trap "rm -f $llogout $rlogout; exit 1" 0 |
228 | 237 |
229 $rlog "$datearg" $rlog_options ${1+"$@"} >$rlogout || exit | 238 case $rlog_options in |
239 ?*) $rlog $rlog_options ${1+"$@"} >$rlogout;; | |
240 '') $rlog "$datearg" ${1+"$@"} >$rlogout | |
241 esac || exit | |
230 | 242 |
231 | 243 |
232 # Get the full name of each author the logs mention, and set initialize_fullname | 244 # Get the full name of each author the logs mention, and set initialize_fullname |
233 # to awk code that initializes the `fullname' awk associative array. | 245 # to awk code that initializes the `fullname' awk associative array. |
234 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled; | 246 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled; |
448 sort +1 -3r +3 +0 | | 460 sort +1 -3r +3 +0 | |
449 | 461 |
450 # Finally, reformat the sorted log entries. | 462 # Finally, reformat the sorted log entries. |
451 $AWK ' | 463 $AWK ' |
452 BEGIN { | 464 BEGIN { |
453 # Some awks do not understand "\r" or "\013", so we have to | 465 # Some awk variants do not understand "\r" or "\013", so we have to |
454 # put a carriage return directly in the file. | 466 # put a carriage return directly in the file. |
455 CR=" | 467 CR=" |
456 " # <-- There is a single CR between the " chars here. | 468 " # <-- There is a single CR between the " chars here. |
457 | 469 |
458 # Initialize the fullname and mailaddr associative arrays. | 470 # Initialize the fullname and mailaddr associative arrays. |