aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2004-03-09 22:47:27 +0000
committerJuanma Barranquero2004-03-09 22:47:27 +0000
commitbdfd0369ce065c4ed22cf74c6f32c6a081eca56f (patch)
tree8ef92ba41799d51d6466bba4d5dedb75b1e5d93d
parent2c8155f78401809603640becd4f25e6858e35b5c (diff)
downloademacs-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/ChangeLog12
-rwxr-xr-xlib-src/grep-changelog62
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 @@
12004-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
12004-03-01 Juanma Barranquero <lektu@terra.es> 132004-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
57if ($result == 0 || $help) { 57if ($result == 0 || $help) {
58 print <<USAGE; 58 print <<USAGE;
59
59Usage: $0 [options] [CHANGELOG...] 60Usage: $0 [options] [CHANGELOG...]
60Print entries in ChangeLogs matching various criteria. Valid options
61are
62 61
63 --author=AUTHOR match entries whose author line matches 62Print entries in ChangeLogs matching various criteria.
63Valid 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
76If no CHANGELOG is specified scan the files "ChangeLog" and 78If 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
78are not recognized. 80are not recognized.
79USAGE 81USAGE
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
85if ($version) { 87if ($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
95sub header_match_p ($) { 97sub 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
125sub entry_match_p ($) { 127sub 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
146sub print_log ($$) { 148sub 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
175sub parse_changelog ($) { 177sub 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.
234unless (@ARGV > 0) { 236unless (@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