diff options
| author | Paul Eggert | 1992-02-05 04:31:18 +0000 |
|---|---|---|
| committer | Paul Eggert | 1992-02-05 04:31:18 +0000 |
| commit | 4ca2c4b44e025ab2478a41ef25177219388ed44e (patch) | |
| tree | 4dfe4d28d05deef8807934094b9852097bb0f428 /lib-src | |
| parent | 5c2c7893d921c760a71ad903e34c599493dd0302 (diff) | |
| download | emacs-4ca2c4b44e025ab2478a41ef25177219388ed44e.tar.gz emacs-4ca2c4b44e025ab2478a41ef25177219388ed44e.zip | |
Add -i, -l, -t.
Diffstat (limited to 'lib-src')
| -rwxr-xr-x | lib-src/rcs2log | 71 |
1 files changed, 58 insertions, 13 deletions
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index aa2b1dd424b..d5fe742e39f 100755 --- a/lib-src/rcs2log +++ b/lib-src/rcs2log | |||
| @@ -2,13 +2,34 @@ | |||
| 2 | 2 | ||
| 3 | # RCS to ChangeLog generator | 3 | # RCS to ChangeLog generator |
| 4 | 4 | ||
| 5 | # $Id$ | 5 | # $Id: rcs2clog,v 1.2 1992/02/05 04:29:40 eggert Exp $ |
| 6 | 6 | ||
| 7 | # Generate a change log prefix from RCS/* and the existing ChangeLog (if any). | 7 | # Generate a change log prefix from RCS/* and the existing ChangeLog (if any). |
| 8 | # Output the new prefix to standard output. | 8 | # Output the new prefix to standard output. |
| 9 | # You can edit this prefix by hand, and then prepend it to ChangeLog. | 9 | # You can edit this prefix by hand, and then prepend it to ChangeLog. |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | # Parse options. | ||
| 13 | |||
| 14 | # defaults | ||
| 15 | indent=8 # indent of log line | ||
| 16 | length=79 # suggested max width of log line | ||
| 17 | tabwidth=8 # width of horizontal tab | ||
| 18 | |||
| 19 | while : | ||
| 20 | do | ||
| 21 | case $1 in | ||
| 22 | -i) indent=${2?};; | ||
| 23 | -l) length=${2?};; | ||
| 24 | -t) tabwidth=${2?};; | ||
| 25 | -*) echo >&2 "$0: usage: $0 [-i indent] [-l length] [-t tabwidth] [file ...]" | ||
| 26 | exit 1;; | ||
| 27 | *) break | ||
| 28 | esac | ||
| 29 | shift; shift | ||
| 30 | done | ||
| 31 | |||
| 32 | |||
| 12 | # Log into $rlogout the revisions checked in since the first ChangeLog entry. | 33 | # Log into $rlogout the revisions checked in since the first ChangeLog entry. |
| 13 | 34 | ||
| 14 | datearg=-d'>1970' | 35 | datearg=-d'>1970' |
| @@ -23,7 +44,11 @@ rlogout=/tmp/chg$$ | |||
| 23 | trap exit 1 2 13 15 | 44 | trap exit 1 2 13 15 |
| 24 | trap 'rm -f $rlogout; exit 1' 0 | 45 | trap 'rm -f $rlogout; exit 1' 0 |
| 25 | 46 | ||
| 26 | rlog "$datearg" RCS/* >$rlogout || exit | 47 | case $# in |
| 48 | 0) set RCS/* | ||
| 49 | esac | ||
| 50 | |||
| 51 | rlog "$datearg" "$@" >$rlogout || exit | ||
| 27 | 52 | ||
| 28 | 53 | ||
| 29 | # Get the full name of each author the logs mention, and set initialize_fullname | 54 | # Get the full name of each author the logs mention, and set initialize_fullname |
| @@ -53,8 +78,11 @@ do | |||
| 53 | ` | 78 | ` |
| 54 | fullname=`echo "$fullname" | sed "s:&:$User:"` | 79 | fullname=`echo "$fullname" | sed "s:&:$User:"` |
| 55 | esac | 80 | esac |
| 56 | initialize_fullname="$initialize_fullname | 81 | case $fullname in |
| 57 | fullname[\"$author\"] = \"$fullname\"" | 82 | ?*) |
| 83 | initialize_fullname="$initialize_fullname | ||
| 84 | fullname[\"$author\"] = \"$fullname\"" | ||
| 85 | esac | ||
| 58 | done | 86 | done |
| 59 | 87 | ||
| 60 | 88 | ||
| @@ -62,9 +90,6 @@ done | |||
| 62 | # We don't use awk functions, to stay compatible with old awk versions. | 90 | # We don't use awk functions, to stay compatible with old awk versions. |
| 63 | # `Log' is the log message (with \n replaced by \r). | 91 | # `Log' is the log message (with \n replaced by \r). |
| 64 | # `files' contains the affected files (each preceded by a space). | 92 | # `files' contains the affected files (each preceded by a space). |
| 65 | LINE_LENGTH=79 # suggested max width of log line | ||
| 66 | LOG_INDENT='\t' # what to indent each log entry with | ||
| 67 | LOG_INDENT_LENGTH=8 # print length of "LOG_INDENT" | ||
| 68 | printlogline='{ | 93 | printlogline='{ |
| 69 | 94 | ||
| 70 | # Following the GNU coding standards, rewrite | 95 | # Following the GNU coding standards, rewrite |
| @@ -79,15 +104,15 @@ printlogline='{ | |||
| 79 | 104 | ||
| 80 | # If "label: comment" is too long, break the line after the ":". | 105 | # If "label: comment" is too long, break the line after the ":". |
| 81 | sep = " " | 106 | sep = " " |
| 82 | if ('"$LINE_LENGTH"' <= '"$LOG_INDENT_LENGTH"' + 1 + length(files) + index(Log, "\r")) sep = "\n'"$LOG_INDENT"'" | 107 | if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, "\r")) sep = "\n" indent_string |
| 83 | 108 | ||
| 84 | # Print the label. | 109 | # Print the label. |
| 85 | printf "'"$LOG_INDENT"'*%s:", files | 110 | printf "%s*%s:", indent_string, files |
| 86 | 111 | ||
| 87 | # Print each line of the log, transliterating \r to \n. | 112 | # Print each line of the log, transliterating \r to \n. |
| 88 | while ((i = index(Log, "\r")) != 0) { | 113 | while ((i = index(Log, "\r")) != 0) { |
| 89 | printf "%s%s\n", sep, substr(Log, 1, i-1) | 114 | printf "%s%s\n", sep, substr(Log, 1, i-1) |
| 90 | sep = "'"$LOG_INDENT"'" | 115 | sep = indent_string |
| 91 | Log = substr(Log, i+1) | 116 | Log = substr(Log, i+1) |
| 92 | } | 117 | } |
| 93 | 118 | ||
| @@ -137,6 +162,15 @@ awk ' | |||
| 137 | # Initialize the fullname associative array. | 162 | # Initialize the fullname associative array. |
| 138 | '"$initialize_fullname"' | 163 | '"$initialize_fullname"' |
| 139 | 164 | ||
| 165 | # Initialize indent string. | ||
| 166 | indent_string = "" | ||
| 167 | i = '"$indent"' | ||
| 168 | if (0 < '"$tabwidth"') | ||
| 169 | for (; '"$tabwidth"' <= i; i -= '"$tabwidth"') | ||
| 170 | indent_string = indent_string "\t" | ||
| 171 | while (1 <= i--) | ||
| 172 | indent_string = indent_string " " | ||
| 173 | |||
| 140 | # Set up date conversion tables. | 174 | # Set up date conversion tables. |
| 141 | # RCS uses a nice, clean, sortable format, | 175 | # RCS uses a nice, clean, sortable format, |
| 142 | # but ChangeLog wants the traditional, ugly ctime format. | 176 | # but ChangeLog wants the traditional, ugly ctime format. |
| @@ -168,6 +202,9 @@ awk ' | |||
| 168 | 202 | ||
| 169 | # Get ready for the next log. | 203 | # Get ready for the next log. |
| 170 | Log = newlog | 204 | Log = newlog |
| 205 | if (files != "") | ||
| 206 | for (i in filesknown) | ||
| 207 | filesknown[i] = 0 | ||
| 171 | files = "" | 208 | files = "" |
| 172 | } | 209 | } |
| 173 | if (date != $2 || author != $4) { | 210 | if (date != $2 || author != $4) { |
| @@ -189,12 +226,20 @@ awk ' | |||
| 189 | if (2 <= month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1 | 226 | if (2 <= month && year%4 == 0 && (year%100 != 0 || year%400 == 0)) leap = 1 |
| 190 | days_since_Sunday_before_epoch = EPOCH_WEEKDAY + year * 365 + int((year + 3) / 4) - int((year + 99) / 100) + int((year + 399) / 400) + mo[month-1] + leap + day - 1 | 227 | days_since_Sunday_before_epoch = EPOCH_WEEKDAY + year * 365 + int((year + 3) / 4) - int((year + 99) / 100) + int((year + 399) / 400) + mo[month-1] + leap + day - 1 |
| 191 | 228 | ||
| 192 | # Print "date fullname (email address)". | 229 | # Print "date fullname (email address)" if the fullname is known; |
| 230 | # print "date author" otherwise. | ||
| 193 | # Get the fullname from the associative array. | 231 | # Get the fullname from the associative array. |
| 194 | # The email address is just author@thishostname. | 232 | # The email address is just author@thishostname. |
| 195 | printf "%s %s %2d %s %d %s (%s@%s)\n\n", w[days_since_Sunday_before_epoch%7], m[month-1], day, $3, year, fullname[author], author, "'"$hostname"'" | 233 | printf "%s %s %2d %s %d ", w[days_since_Sunday_before_epoch%7], m[month-1], day, $3, year |
| 234 | if (fullname[author]) | ||
| 235 | printf "%s (%s@%s)\n\n", fullname[author], author, "'"$hostname"'" | ||
| 236 | else | ||
| 237 | printf "%s\n\n", author | ||
| 238 | } | ||
| 239 | if (! filesknown[$1]) { | ||
| 240 | filesknown[$1] = 1 | ||
| 241 | files = files " " $1 | ||
| 196 | } | 242 | } |
| 197 | files = files " " $1 | ||
| 198 | } | 243 | } |
| 199 | END { | 244 | END { |
| 200 | # Print the last log. | 245 | # Print the last log. |