Mercurial > emacs
comparison lib-src/rcs2log @ 8549:12b36ece5c25
Add support for CVS.
Work with `rlog's that output ISO 8601 dates.
author | Paul Eggert <eggert@twinsun.com> |
---|---|
date | Mon, 15 Aug 1994 22:44:10 +0000 |
parents | 2dba6eb73c65 |
children | 554c86f77db0 |
comparison
equal
deleted
inserted
replaced
8548:46da92c1706c | 8549:12b36ece5c25 |
---|---|
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.16 1993/10/19 02:50:31 eggert Exp rms $ | 15 # $Id: rcs2log,v 1.17 1994/08/09 20:43:48 rms Exp eggert $ |
16 | 16 |
17 # Copyright 1992, 1993 Free Software Foundation, Inc. | 17 # Copyright 1992, 1993 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 |
138 ?*) date=$d | 138 ?*) date=$d |
139 esac | 139 esac |
140 fi | 140 fi |
141 datearg="-d>$date" | 141 datearg="-d>$date" |
142 | 142 |
143 repository= | |
144 rlog=rlog | |
145 case $CVSROOT in | |
146 ?*) | |
147 if test -d "$CVSROOT" && test -f CVS/Repository | |
148 then | |
149 r=`cat <CVS/Repository` || exit | |
150 if test -d "$CVSROOT/$r" | |
151 then | |
152 repository=$CVSROOT/$r | |
153 rlog='cvs log' | |
154 fi | |
155 fi | |
156 esac | |
157 | |
143 # With no arguments, examine all files under the RCS directory. | 158 # With no arguments, examine all files under the RCS directory. |
144 case $# in | 159 case $# in |
145 0) | 160 0) |
146 files= | 161 case $repository in |
147 for file in RCS/.* RCS/* .*,v *,v | 162 '') |
148 do | 163 files= |
149 case $file in | 164 for file in RCS/.* RCS/* .*,v *,v |
150 RCS/. | RCS/..) continue;; | 165 do |
151 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue | 166 case $file in |
167 RCS/. | RCS/..) continue;; | |
168 RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue | |
169 esac | |
170 files=$files$nl$file | |
171 done | |
172 case $files in | |
173 '') exit 0 | |
152 esac | 174 esac |
153 files=$files$nl$file | 175 oldIFS=$IFS |
154 done | 176 IFS=$nl |
155 case $files in | 177 set $files |
156 '') exit 0 | 178 IFS=$oldIFS |
157 esac | 179 esac |
158 oldIFS=$IFS | |
159 IFS=$nl | |
160 set $files | |
161 IFS=$oldIFS | |
162 esac | 180 esac |
163 | 181 |
164 rlogout=$TMPDIR/rcs2log$$r | 182 rlogout=$TMPDIR/rcs2log$$r |
165 trap exit 1 2 13 15 | 183 trap exit 1 2 13 15 |
166 trap "rm -f $loginsout $rlogout; exit 1" 0 | 184 trap "rm -f $loginsout $rlogout; exit 1" 0 |
167 | 185 |
168 rlog "$datearg" $rlog_options "$@" >$rlogout || exit | 186 $rlog "$datearg" $rlog_options ${1+"$@"} >$rlogout || exit |
169 | 187 |
170 | 188 |
171 # Get the full name of each author the logs mention, and set initialize_fullname | 189 # Get the full name of each author the logs mention, and set initialize_fullname |
172 # to awk code that initializes the `fullname' awk associative array. | 190 # to awk code that initializes the `fullname' awk associative array. |
173 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled; | 191 # Warning: foreign authors (i.e. not known in the passwd file) are mishandled; |
177 ?*) sort -u -o $loginsout <<EOF || exit | 195 ?*) sort -u -o $loginsout <<EOF || exit |
178 $logins | 196 $logins |
179 EOF | 197 EOF |
180 esac | 198 esac |
181 authors=` | 199 authors=` |
182 sed -n 's|^date: *[0-9]*/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]; *author: *\([^; ]*\).*|\1|p' <$rlogout | | 200 sed -n 's|^date: *[0-9]*[-/][0-9][0-9][-/][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9]*; *author: *\([^; ]*\).*|\1|p' <$rlogout | |
183 case $loginsout in | 201 case $loginsout in |
184 '') sort -u;; | 202 '') sort -u;; |
185 ?*) sort -u | comm -23 - $loginsout | 203 ?*) sort -u | comm -23 - $loginsout |
186 esac | 204 esac |
187 ` | 205 ` |
288 # Discard irrelevant rlog output. | 306 # Discard irrelevant rlog output. |
289 awk <$rlogout ' | 307 awk <$rlogout ' |
290 /^Working file:/ { filename = $3 } | 308 /^Working file:/ { filename = $3 } |
291 /^date: /, /^(-----------*|===========*)$/ { | 309 /^date: /, /^(-----------*|===========*)$/ { |
292 if ($0 ~ /^branches: /) { next } | 310 if ($0 ~ /^branches: /) { next } |
293 if ($0 ~ /^date: [0-9][ \/0-9:]*;/) { | 311 if ($0 ~ /^date: [0-9][- +\/0-9:]*;/) { |
294 time = substr($3, 1, length($3)-1) | 312 date = $2 |
313 if (date ~ /-/) { | |
314 # An ISO format date. Replace all "-"s with "/"s. | |
315 newdate = "" | |
316 while ((i = index(date, "-")) != 0) { | |
317 newdate = newdate substr(date, 1, i-1) "/" | |
318 date = substr(date, i+1) | |
319 } | |
320 date = newdate date | |
321 } | |
322 # Ignore any time zone; ChangeLog has no room for it. | |
323 time = substr($3, 1, 8) | |
295 author = substr($5, 1, length($5)-1) | 324 author = substr($5, 1, length($5)-1) |
296 printf "%s %s %s %s %c", filename, $2, time, author, 13 | 325 printf "%s %s %s %s %c", filename, date, time, author, 13 |
297 next | 326 next |
298 } | 327 } |
299 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next } | 328 if ($0 ~ /^(-----------*|===========*)$/) { print ""; next } |
300 printf "%s%c", $0, 13 | 329 printf "%s%c", $0, 13 |
301 } | 330 } |