diff options
| author | Juanma Barranquero | 2004-03-09 22:47:27 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2004-03-09 22:47:27 +0000 |
| commit | bdfd0369ce065c4ed22cf74c6f32c6a081eca56f (patch) | |
| tree | 8ef92ba41799d51d6466bba4d5dedb75b1e5d93d | |
| parent | 2c8155f78401809603640becd4f25e6858e35b5c (diff) | |
| download | emacs-bdfd0369ce065c4ed22cf74c6f32c6a081eca56f.tar.gz emacs-bdfd0369ce065c4ed22cf74c6f32c6a081eca56f.zip | |
Changes to support ChangeLog.10+.
(main): Tidy up usage string. Fix "Use of uninitialized value" warning.
Set version to 0.2. Parse the directory listing to get any ChangeLog.n
file, not just 1..9.
(header_match_p, entry_match_p, print_log, parse_changelog): Remove Perl
prototypes (their purpose is to help the parser, which isn't needed here,
not declare arguments).
(parse_changelog): Make --reverse faster on big batches by not modifying
the entries list.
| -rw-r--r-- | lib-src/ChangeLog | 12 | ||||
| -rwxr-xr-x | lib-src/grep-changelog | 62 |
2 files changed, 49 insertions, 25 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 9876b0b041a..4e995ff185a 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2004-03-09 Juanma Barranquero <lektu@terra.es> | ||
| 2 | |||
| 3 | * grep-changelog: Changes to support ChangeLog.10+. | ||
| 4 | (main): Tidy up usage string. Fix "Use of uninitialized value" | ||
| 5 | warning. Set version to 0.2. Parse the directory listing to get | ||
| 6 | any ChangeLog.n file, not just 1..9. | ||
| 7 | (header_match_p, entry_match_p, print_log, parse_changelog): | ||
| 8 | Remove Perl prototypes (their purpose is to help the parser, which | ||
| 9 | isn't needed here, not declare arguments). | ||
| 10 | (parse_changelog): Make --reverse faster on big batches by not | ||
| 11 | modifying the entries list. | ||
| 12 | |||
| 1 | 2004-03-01 Juanma Barranquero <lektu@terra.es> | 13 | 2004-03-01 Juanma Barranquero <lektu@terra.es> |
| 2 | 14 | ||
| 3 | * makefile.w32-in (obj): Add fringe.c. | 15 | * makefile.w32-in (obj): Add fringe.c. |
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog index 9baf0213db7..38fce879c7a 100755 --- a/lib-src/grep-changelog +++ b/lib-src/grep-changelog | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #! /usr/bin/perl | 1 | #! /usr/bin/perl |
| 2 | 2 | ||
| 3 | # Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 3 | # Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. |
| 4 | # | 4 | # |
| 5 | # This file is part of GNU Emacs. | 5 | # This file is part of GNU Emacs. |
| 6 | # | 6 | # |
| @@ -56,34 +56,36 @@ $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; | |||
| 56 | 56 | ||
| 57 | if ($result == 0 || $help) { | 57 | if ($result == 0 || $help) { |
| 58 | print <<USAGE; | 58 | print <<USAGE; |
| 59 | |||
| 59 | Usage: $0 [options] [CHANGELOG...] | 60 | Usage: $0 [options] [CHANGELOG...] |
| 60 | Print entries in ChangeLogs matching various criteria. Valid options | ||
| 61 | are | ||
| 62 | 61 | ||
| 63 | --author=AUTHOR match entries whose author line matches | 62 | Print entries in ChangeLogs matching various criteria. |
| 63 | Valid options are: | ||
| 64 | |||
| 65 | --author=AUTHOR Match entries whose author line matches | ||
| 64 | regular expression AUTHOR | 66 | regular expression AUTHOR |
| 65 | --text=TEXT match entries whose text matches regular | 67 | --text=TEXT Match entries whose text matches regular |
| 66 | expression TEXT. | 68 | expression TEXT |
| 67 | --exclude=TEXT exclude entries matching TEXT. | 69 | --exclude=TEXT Exclude entries matching TEXT |
| 68 | --from-date=YYYY-MM-DD match entries not older than given date | 70 | --from-date=YYYY-MM-DD Match entries not older than given date |
| 69 | --to-date=YYYY-MM-DD match entries not younger than given date | 71 | --to-date=YYYY-MM-DD Match entries not younger than given date |
| 70 | --rcs-log format output suitable for RCS log entries. | 72 | --rcs-log Format output suitable for RCS log entries |
| 71 | --with-date print short date line in RCS log | 73 | --with-date Print short date line in RCS log |
| 72 | --reverse show entries in reverse (chronological) order | 74 | --reverse Show entries in reverse (chronological) order |
| 73 | --version print version info | 75 | --version Print version info |
| 74 | --help print this help | 76 | --help Print this help |
| 75 | 77 | ||
| 76 | If no CHANGELOG is specified scan the files "ChangeLog" and | 78 | If no CHANGELOG is specified scan the files "ChangeLog" and |
| 77 | "ChangeLog.[9-1]" in the current directory. Old-style dates in ChangeLogs | 79 | "ChangeLog.1+" in the current directory. Old-style dates in ChangeLogs |
| 78 | are not recognized. | 80 | are not recognized. |
| 79 | USAGE | 81 | USAGE |
| 80 | exit $help ? 0 : 1; | 82 | exit !$help; |
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | # Print version info and exit if `--version' was specified. | 85 | # Print version info and exit if `--version' was specified. |
| 84 | 86 | ||
| 85 | if ($version) { | 87 | if ($version) { |
| 86 | print "0.1\n"; | 88 | print "0.2\n"; |
| 87 | exit 0; | 89 | exit 0; |
| 88 | } | 90 | } |
| 89 | 91 | ||
| @@ -92,7 +94,7 @@ if ($version) { | |||
| 92 | # options specified, i.e. it matches $author, and its date is in | 94 | # options specified, i.e. it matches $author, and its date is in |
| 93 | # the range $from_date <= date <= $to_date. | 95 | # the range $from_date <= date <= $to_date. |
| 94 | 96 | ||
| 95 | sub header_match_p ($) { | 97 | sub header_match_p { |
| 96 | my $header = shift; | 98 | my $header = shift; |
| 97 | 99 | ||
| 98 | return 0 unless $header; | 100 | return 0 unless $header; |
| @@ -122,7 +124,7 @@ sub header_match_p ($) { | |||
| 122 | # command line, i.e. it matches $regexp, and it doesn't match | 124 | # command line, i.e. it matches $regexp, and it doesn't match |
| 123 | # $exclude. | 125 | # $exclude. |
| 124 | 126 | ||
| 125 | sub entry_match_p ($) { | 127 | sub entry_match_p { |
| 126 | my $entry = shift; | 128 | my $entry = shift; |
| 127 | 129 | ||
| 128 | return 0 unless $entry; | 130 | return 0 unless $entry; |
| @@ -143,7 +145,7 @@ sub entry_match_p ($) { | |||
| 143 | # lines are not printed, and leading spaces and file names are removed | 145 | # lines are not printed, and leading spaces and file names are removed |
| 144 | # from ChangeLog entries. | 146 | # from ChangeLog entries. |
| 145 | 147 | ||
| 146 | sub print_log ($$) { | 148 | sub print_log { |
| 147 | my ($header, $entry) = @_; | 149 | my ($header, $entry) = @_; |
| 148 | my $output = ''; | 150 | my $output = ''; |
| 149 | 151 | ||
| @@ -172,7 +174,7 @@ sub print_log ($$) { | |||
| 172 | 174 | ||
| 173 | # Scan LOG for matching entries, and print them to standard output. | 175 | # Scan LOG for matching entries, and print them to standard output. |
| 174 | 176 | ||
| 175 | sub parse_changelog ($) { | 177 | sub parse_changelog { |
| 176 | my $log = shift; | 178 | my $log = shift; |
| 177 | my $entry = undef; | 179 | my $entry = undef; |
| 178 | my $header = undef; | 180 | my $header = undef; |
| @@ -219,8 +221,8 @@ sub parse_changelog ($) { | |||
| 219 | close IN; | 221 | close IN; |
| 220 | 222 | ||
| 221 | if ($reverse) { | 223 | if ($reverse) { |
| 222 | while (defined (my $entry = pop @entries)) { | 224 | for (my $entry = @entries; $entry; $entry--) { |
| 223 | print $entry; | 225 | print $entries[$entry-1]; |
| 224 | } | 226 | } |
| 225 | } | 227 | } |
| 226 | } | 228 | } |
| @@ -230,9 +232,19 @@ sub parse_changelog ($) { | |||
| 230 | 232 | ||
| 231 | # If files were specified on the command line, parse those files in the | 233 | # If files were specified on the command line, parse those files in the |
| 232 | # order supplied by the user; otherwise parse default files ChangeLog and | 234 | # order supplied by the user; otherwise parse default files ChangeLog and |
| 233 | # ChangeLog.9...ChangeLog.1 according to $reverse. | 235 | # ChangeLog.1+ according to $reverse. |
| 234 | unless (@ARGV > 0) { | 236 | unless (@ARGV > 0) { |
| 235 | @ARGV = ("ChangeLog", map {"ChangeLog.$_"} reverse 1..9); | 237 | @ARGV = ("ChangeLog"); |
| 238 | |||
| 239 | push @ARGV, | ||
| 240 | map {"ChangeLog.$_"} | ||
| 241 | sort {$b <=> $a} | ||
| 242 | map {/\.(\d+)$/; $1} | ||
| 243 | do { | ||
| 244 | opendir D, '.'; | ||
| 245 | grep /^ChangeLog\.\d+$/, readdir D; | ||
| 246 | }; | ||
| 247 | |||
| 236 | @ARGV = reverse @ARGV if $reverse; | 248 | @ARGV = reverse @ARGV if $reverse; |
| 237 | } | 249 | } |
| 238 | 250 | ||