Mercurial > emacs
annotate lib-src/grep-changelog @ 111857:b8a431283d07
shr.el (shr-image-displayer): Work for images lined side by side.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Thu, 09 Dec 2010 06:40:56 +0000 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
28823 | 1 #! /usr/bin/perl |
25216 | 2 |
64769
6358e3c6075c
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64083
diff
changeset
|
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, |
106815 | 4 # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
25216 | 5 # |
6 # This file is part of GNU Emacs. | |
94828
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
7 |
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
8 # GNU Emacs is free software: you can redistribute it and/or modify |
25216 | 9 # it under the terms of the GNU General Public License as published by |
94828
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
10 # the Free Software Foundation, either version 3 of the License, or |
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
11 # (at your option) any later version. |
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
12 |
25216 | 13 # GNU Emacs is distributed in the hope that it will be useful, |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 # GNU General Public License for more details. | |
94828
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
17 |
25216 | 18 # You should have received a copy of the GNU General Public License |
94828
3a4bc081639c
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79748
diff
changeset
|
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
25216 | 20 |
21 | |
22 # Extract entries from ChangeLogs matching specified criteria. | |
23 # Optionally format the resulting output to a form suitable for RCS | |
24 # logs, like they are used in Emacs, for example. In this format, | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
25 # author lines, leading spaces, and file names are removed. |
25216 | 26 |
27 require 5; | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
28 use strict; |
25216 | 29 |
30 # Parse command line options. | |
31 | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
32 use vars qw($author $regexp $exclude $from_date $to_date |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
33 $rcs_log $with_date $version $help $reverse |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
34 @entries); |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
35 |
25216 | 36 use Getopt::Long; |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
37 |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
38 my $result; |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
39 |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
40 if (@ARGV == 0) { |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
41 |
100397 | 42 # No arguments cannot possibly mean "show everything"!! |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
43 $result = 0; |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
44 |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
45 } else { |
25216 | 46 |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
47 $result = GetOptions ("author=s" => \$author, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
48 "text=s" => \$regexp, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
49 "exclude=s" => \$exclude, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
50 "from-date=s" => \$from_date, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
51 "to-date=s" => \$to_date, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
52 "rcs-log" => \$rcs_log, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
53 "with-date" => \$with_date, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
54 "reverse!" => \$reverse, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
55 "version" => \$version, |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
56 "help" => \$help); |
25216 | 57 |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
58 # If date options are specified, check that they have the format |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
59 # YYYY-MM-DD. |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
60 |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
61 $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
62 $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; |
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
63 } |
25216 | 64 |
65 # Print usage information and exit when necessary. | |
66 | |
67 if ($result == 0 || $help) { | |
68 print <<USAGE; | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
69 |
25216 | 70 Usage: $0 [options] [CHANGELOG...] |
71 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
72 Print entries in ChangeLogs matching various criteria. |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
73 Valid options are: |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
74 |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
75 --author=AUTHOR Match entries whose author line matches |
25216 | 76 regular expression AUTHOR |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
77 --text=TEXT Match entries whose text matches regular |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
78 expression TEXT |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
79 --exclude=TEXT Exclude entries matching TEXT |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
80 --from-date=YYYY-MM-DD Match entries not older than given date |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
81 --to-date=YYYY-MM-DD Match entries not younger than given date |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
82 --rcs-log Format output suitable for RCS log entries |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
83 --with-date Print short date line in RCS log |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
84 --reverse Show entries in reverse (chronological) order |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
85 --version Print version info |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
86 --help Print this help |
25216 | 87 |
88 If no CHANGELOG is specified scan the files "ChangeLog" and | |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
89 "ChangeLog.N+" in the current directory. Old-style dates in ChangeLogs |
25216 | 90 are not recognized. |
91 USAGE | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
92 exit !$help; |
25216 | 93 } |
94 | |
95 # Print version info and exit if `--version' was specified. | |
96 | |
97 if ($version) { | |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
98 print "0.3\n"; |
25216 | 99 exit 0; |
100 } | |
101 | |
102 | |
103 # Value is non-zero if HEADER matches according to command line | |
104 # options specified, i.e. it matches $author, and its date is in | |
105 # the range $from_date <= date <= $to_date. | |
106 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
107 sub header_match_p { |
25216 | 108 my $header = shift; |
109 | |
38502
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
110 return 0 unless $header; |
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
111 |
25216 | 112 # No match if AUTHOR-regexp specified and doesn't match. |
113 return 0 if $author && $header !~ /$author/; | |
114 | |
115 # Check that the date of the entry matches if date options | |
116 # `--from-date' and/or `--to-date' were specified . Old-style | |
117 # dates in ChangeLogs are not recognized, and never match. | |
118 if ($from_date || $to_date) { | |
119 if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) { | |
120 my $date = $1; | |
121 return 0 if $from_date && $date lt $from_date; | |
122 return 0 if $to_date && $date gt $to_date; | |
123 } else { | |
124 # Don't bother recognizing old-style dates. | |
125 return 0; | |
126 } | |
127 } | |
128 | |
129 return 1; | |
130 } | |
131 | |
132 | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
133 # Value is non-zero if ENTRY matches the criteria specified on the |
25216 | 134 # command line, i.e. it matches $regexp, and it doesn't match |
135 # $exclude. | |
136 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
137 sub entry_match_p { |
25216 | 138 my $entry = shift; |
139 | |
38502
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
140 return 0 unless $entry; |
180f542bf5b4
(entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents:
38500
diff
changeset
|
141 |
25216 | 142 if ($regexp) { |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
143 return 1 if ($entry =~ /$regexp/ |
25216 | 144 && (!$exclude || $entry !~ $exclude)); |
145 } else { | |
146 return 1 if !$exclude || $entry !~ $exclude; | |
147 } | |
148 | |
149 return 0; | |
150 } | |
151 | |
152 | |
153 # Print HEADER and/or ENTRY in a format suitable for what was | |
154 # specified on the command line. If $rcs_log is specified, author | |
155 # lines are not printed, and leading spaces and file names are removed | |
156 # from ChangeLog entries. | |
157 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
158 sub print_log { |
25216 | 159 my ($header, $entry) = @_; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
160 my $output = ''; |
25216 | 161 |
162 if ($rcs_log) { | |
163 # Remove leading whitespace from entry. | |
164 $entry =~ s/^\s+//mg; | |
165 # Remove file name parts. | |
166 $entry =~ s/^\*.*\(/(/mg; | |
167 # Remove file name parts, 2. | |
168 $entry =~ s/^\*.*://mg; | |
169 if ($with_date) { | |
170 $header =~ /(\d\d\d\d-\d\d-\d\d)/; | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
171 $output = "!changelog-date $1\n"; |
25216 | 172 } |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
173 $output .= $entry; |
25216 | 174 } else { |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
175 $output .= $header . $entry; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
176 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
177 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
178 if ($reverse) { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
179 push @entries, $output; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
180 } else { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
181 print $output; |
25216 | 182 } |
183 } | |
184 | |
185 # Scan LOG for matching entries, and print them to standard output. | |
186 | |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
187 sub parse_changelog { |
25216 | 188 my $log = shift; |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
189 my $entry = undef; |
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
190 my $header = undef; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
191 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
192 @entries = () if $reverse; |
25216 | 193 |
194 # Open the ChangeLog. | |
195 open (IN, "< $log") || die "Cannot open $log: $!"; | |
196 | |
38509
59acf1c91dd2
(main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents:
38504
diff
changeset
|
197 while (defined(my $line = <IN>)) { |
25216 | 198 if ($line =~ /^\S/) { |
199 # Line is an author-line. Print previous entry if | |
200 # it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
201 print_log ($header, $entry) |
25216 | 202 if header_match_p ($header) && entry_match_p ($entry); |
203 | |
204 $entry = ""; | |
205 $header = $line; | |
206 | |
207 # Add empty lines below the header. | |
38500
3db3b0888252
(parse_changelog): Add test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
29638
diff
changeset
|
208 while (defined($line = <IN>) && $line =~ /^\s*$/) { |
25216 | 209 $header = "$header$line"; |
210 } | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
211 } |
25216 | 212 |
38504
1d53627a58ae
(parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
38502
diff
changeset
|
213 last unless defined $line; |
1d53627a58ae
(parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents:
38502
diff
changeset
|
214 |
25216 | 215 if ($line =~ /^\s*\*/) { |
216 # LINE is the first line of a ChangeLog entry. Print | |
217 # previous entry if it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
218 print_log ($header, $entry) |
25216 | 219 if header_match_p ($header) && entry_match_p ($entry); |
220 $entry = $line; | |
221 } else { | |
222 # Add LINE to the current entry. | |
223 $entry = "$entry$line"; | |
224 } | |
225 } | |
226 | |
227 # Print last entry if it matches. | |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
228 print_log ($header, $entry) |
25216 | 229 if header_match_p ($header) && entry_match_p ($entry); |
230 | |
231 close IN; | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
232 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
233 if ($reverse) { |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
234 for (my $entry = @entries; $entry; $entry--) { |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
235 print $entries[$entry-1]; |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
236 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
237 } |
25216 | 238 } |
239 | |
240 | |
241 # Main program. Process ChangeLogs. | |
242 | |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
243 # If files were specified on the command line, parse those files in the |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
244 # order supplied by the user; otherwise parse default files ChangeLog and |
73621
3e566ec9ef5d
When called with no arguments (not even a filter), show help instead of
Juanma Barranquero <lekktu@gmail.com>
parents:
68647
diff
changeset
|
245 # ChangeLog.NNN according to $reverse. |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
246 unless (@ARGV > 0) { |
54324
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
247 @ARGV = ("ChangeLog"); |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
248 |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
249 push @ARGV, |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
250 map {"ChangeLog.$_"} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
251 sort {$b <=> $a} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
252 map {/\.(\d+)$/; $1} |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
253 do { |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
254 opendir D, '.'; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
255 grep /^ChangeLog\.\d+$/, readdir D; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
256 }; |
bdf4aa3226e7
Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
257 |
38551
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
258 @ARGV = reverse @ARGV if $reverse; |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
259 } |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
260 |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
261 while (defined (my $log = shift @ARGV)) { |
6bd3c93022e7
(parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38510
diff
changeset
|
262 parse_changelog ($log) if -f $log; |
25216 | 263 } |
264 | |
265 | |
52401 | 266 # arch-tag: 9e4f6749-e053-4bb7-b3ad-11947318418e |
29638
f6a97d806845
Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents:
28823
diff
changeset
|
267 # grep-changelog ends here. |