annotate lib-src/grep-changelog @ 73331:f21883dcffa9

Merge from upstream, upto version 5.22. After 5.0: `cperl-add-tags-recurse-noxs-fullpath': new function (for -batch mode) After 5.1: ;; Major edit. Summary of most visible changes: ;; a) Multiple <<HERE per line allowed. ;; b) Handles multiline subroutine declaration headers (with comments). ;; (The exception is `cperl-etags' - but it is not used in the rest ;; of the mode.) ;; c) Fontifies multiline my/our declarations (even with comments, ;; and with legacy `font-lock'). ;; d) Major speedup of syntaxification, both immediate and postponed ;; (3.5x to 15x [for different CPUs and versions of Emacs] on the ;; huge real-life document I tested). ;; e) New bindings, edits to imenu. ;; f) "_" is made into word-char during fontification/syntaxification; ;; some attempts to recognize non-word "_" during other operations too. ;; g) Detect bug in Emacs with `looking-at' inside `narrow' and bulk out. ;; h) autoload some more perldoc-related stuff ;; i) Some new convenience features: ISpell POD/HEREDOCs, narrow-to-HEREDOC ;; j) Attempt to incorporate XEmacs edits which reached me Fine-grained changelog: `cperl-hook-after-change': New configuration variable `cperl-vc-sccs-header': Likewise. `cperl-vc-sccs-header': Likewise. `cperl-vc-header-alist': Default via two preceding variables `cperl-invalid-face': Remove double quoting under XEmacs (still needed under 21.2) `cperl-tips': Update URLs for resources `cperl-problems': Likewise. `cperl-praise': Mention new features New C-c key bindings: for `cperl-find-bad-style', `cperl-pod-spell', `cperl-here-doc-spell', `cperl-narrow-to-here-doc', `cperl-perdoc', `cperl-perldoc-at-point' CPerl Mode menu changes: "Fix style by spaces", "Imenu on Perl Info" moved, new submenu of Tools with Ispell entries and narrowing. `cperl-after-sub-regexp': New defsubst `cperl-imenu--function-name-regexp-perl': Use `cperl-after-sub-regexp', Allows heads up to head4 Allow "package;" `defun-prompt-regexp': Use `cperl-after-sub-regexp', `paren-backwards-message': ??? Something for XEmacs??? `cperl-mode': Never auto-switch abbrev-mode off Try to allow '_' be non-word char Do not use `font-lock-unfontify-region-function' on XEmacs Reset syntax cache on mode start Support multiline facification (even on legacy `font-lock') `cperl-facemenu-add-face-function': ??? Some contributed code ??? `cperl-after-change-function': Since `font-lock' and `lazy-lock' refuse to inform us whether the fontification is due to lazy calling or due to edit to a buffer, install our own hook (controlled by `cperl-hook-after-change') `cperl-electric-pod': =cut may have been recognized as start `cperl-block-p': Moved, updated for attributes `cperl-calculate-indent': Try to allow '_' be non-word char Support subs with attributes `cperl-where-am-i': Queit (?) a warning `cperl-cached-syntax-table' New function `cperl-forward-re': Use `cperl-cached-syntax-table' `cperl-unwind-to-safe': Recognize `syntax-type' property changing in a middle of line `cperl-find-sub-attrs': New function `cperl-find-pods-heres': Allow many <<EOP per line Allow subs with attributes Major speedups (3.5x..15x on a real-life test file nph-proxy.pl) Recognize "extproc " (OS/2) case-folded and only at start /x on s///x with empty replacement was not recognized Better comments `cperl-after-block-p': Remarks on diff with `cperl-block-p' Allow subs with attributes, labels Do not confuse "else::foo" with "else" Minor optimizations... `cperl-after-expr-p': Try to allow '_' be non-word char `cperl-fill-paragraph': Try to detect a major bug in Emacs with `looking-at' inside `narrow' and bulk out if found `cperl-imenu--create-perl-index': Updates for new `cperl-imenu--function-name-regexp-perl' `cperl-outline-level': Likewise. `cperl-init-faces': Allow multiline subroutine headers and my/our declarations, and ones with comments Allow subroutine attributes `cperl-imenu-on-info': Better docstring. `cperl-etags' Rudimentary support for attributes Support for packages and "package;" `cperl-add-tags-recurse-noxs': Better (?) docstring `cperl-add-tags-recurse-noxs-fullpath': Likewise. `cperl-tags-hier-init': Misprint for `fboundp' fixed `cperl-not-bad-style-regexp': Try to allow '_' be non-word char `cperl-perldoc': Add autoload `cperl-perldoc-at-point': Likewise. `cperl-here-doc-spell': New function `cperl-pod-spell': Likewise. `cperl-map-pods-heres': Likewise. `cperl-get-here-doc-region': Likewise. `cperl-font-lock-fontify-region-function': Likewise (backward compatibility for legacy `font-lock') `cperl-font-lock-unfontify-region-function': Fix style `cperl-fontify-syntaxically': Recognize and optimize away deferred calls with no-change. Governed by `cperl-hook-after-change' `cperl-fontify-update': Recognize that syntaxification region can be larger than fontification one. XXXX we leave `cperl-postpone' property, so this is quadratic... `cperl-fontify-update-bad': Temporary placeholder until it is clear how to implement `cperl-fontify-update'. `cperl-time-fontification': New function `attrib-group': New text attribute `multiline': New value: `syntax-type' text attribute After 5.2: `cperl-emulate-lazy-lock': New function `cperl-fontify-syntaxically': Would skip large regions Add `cperl-time-fontification', `cperl-emulate-lazy-lock' to menu Some globals were declared, but uninitialized After 5.3, 5.4: `cperl-facemenu-add-face-function': Add docs, fix U<> Copyright message updated. `cperl-init-faces': Work around a bug in `font-lock'. May slow facification down a bit. Misprint for my|our|local for old `font-lock' "our" was not fontified same as "my|local" Highlight variables after "my" etc even in a middle of an expression Do not facify multiple variables after my etc unless parentheses are present After 5.5, 5.6 `cperl-fontify-syntaxically': after-change hook could reset `cperl-syntax-done-to' to a middle of line; unwind to BOL. After 5.7: `cperl-init-faces': Allow highlighting of local ($/) `cperl-problems-old-emaxen': New variable (for the purpose of DOCSTRING). `cperl-problems': Remove fixed problems. `cperl-find-pods-heres': Recognize #-comments in m##x too Recognize charclasses (unless delimiter is \). `cperl-fontify-syntaxically': Unwinding to safe was done in wrong order `cperl-regexp-scan': Update docs `cperl-beautify-regexp-piece': use information got from regexp scan After 5.8: Major user visible changes: Recognition and fontification of character classes in RExen. Variable indentation of RExen according to groups `cperl-find-pods-heres': Recognize POSIX classes in REx charclasses Fontify REx charclasses in variable-name face Fontify POSIX charclasses in "type" face Fontify unmatched "]" in function-name face Mark first-char of HERE-doc as `front-sticky' Reset `front-sticky' property when needed `cperl-calculate-indent': Indents //x -RExen accordning to parens level `cperl-to-comment-or-eol': Recognize ends of `syntax-type' constructs `cperl-backward-to-noncomment': Recognize stringy `syntax-type' constructs Support `narrow'ed buffers. `cperl-praise': Remove a reservation `cperl-make-indent': New function `cperl-indent-for-comment': Use `cperl-make-indent' `cperl-indent-line': Likewise. `cperl-lineup': Likewise. `cperl-beautify-regexp-piece': Likewise. `cperl-contract-level': Likewise. `cperl-toggle-set-debug-unwind': New function New menu entry for this `fill-paragraph-function': Use when `boundp' `cperl-calculate-indent': Take into account groups when indenting RExen `cperl-to-comment-or-eol': Recognize # which end a string `cperl-modify-syntax-type': Make only syntax-table property non-sticky `cperl-fill-paragraph': Return t: needed for `fill-paragraph-function' `cperl-fontify-syntaxically': More clear debugging message `cperl-pod2man-build-command': XEmacs portability: check `Man-filter-list' `cperl-init-faces': More complicated highlight even on XEmacs (new) Merge cosmetic changes from XEmacs After 5.9: `cperl-1+': Moved to before the first use `cperl-1-': Likewise. After 5.10: This code may lock Emacs hard!!! Use on your own risk! `cperl-font-locking': New internal variable `cperl-beginning-of-property': New function `cperl-calculate-indent': Use `cperl-beginning-of-property' instead of `previous-single-property-change' `cperl-unwind-to-safe': Likewise. `cperl-after-expr-p': Likewise. `cperl-get-here-doc-region': Likewise. `cperl-font-lock-fontify-region-function': Likewise. `cperl-to-comment-or-eol': Do not call `cperl-update-syntaxification' recursively Bound `next-single-property-change' via `point-max' `cperl-unwind-to-safe': Bound likewise `cperl-font-lock-fontify-region-function': Likewise. `cperl-find-pods-heres': Mark as recursive for `cperl-to-comment-or-eol' Initialization of `cperl-font-lock-multiline-start' could be missed if the "main" fontification did not run due to the keyword being already fontified. `cperl-pod-spell': Return t from do-one-chunk function `cperl-map-pods-heres': Stop when the worker returns nil Call `cperl-update-syntaxification' `cperl-get-here-doc-region': Call `cperl-update-syntaxification' `cperl-get-here-doc-delim': Remove unused function After 5.11: The possible lockup of Emacs (introduced in 5.10) fixed `cperl-unwind-to-safe': `cperl-beginning-of-property' won't return nil `cperl-syntaxify-for-menu': New customization variable `cperl-select-this-pod-or-here-doc': New function `cperl-get-here-doc-region': Extra argument Do not adjust pos by 1 New menu entries (Perl/Tools): Selection of current POD or HERE-DOC section (Debugging CPerl:) backtrace on fontification After 5.12: `cperl-cached-syntax-table': use `car-safe' `cperl-forward-re': Remove spurious argument SET-ST Add documentation `cperl-forward-group-in-re': New function `cperl-find-pods-heres': Find and highlight (?{}) blocks in RExen (XXXX Temporary (?) hack is to syntax-mark them as comment) After 5.13: `cperl-string-syntax-table': Make { and } not-grouping (Sometimes they ARE grouping in RExen, but matching them would only confuse in many situations when they are not) `beginning-of-buffer': Replaced two occurences with goto-char... `cperl-calculate-indent': `char-after' could be nil... `cperl-find-pods-heres': REx can start after "[" too Hightlight (??{}) in RExen too `cperl-maybe-white-and-comment-rex': New constant `cperl-white-and-comment-rex': Likewise. XXXX Not very efficient, but hard to make better while keeping 1 group After 5.13: `cperl-find-pods-heres': $foo << identifier() is not a HERE-DOC Likewise for 1 << identifier After 5.14: `cperl-find-pods-heres': Different logic for $foo .= <<EOF etc Error-less condition-case could fail `cperl-font-lock-fontify-region-function': Likewise. `cperl-init-faces': Likewise. After 5.15: `cperl-find-pods-heres': Support property REx-part2 `cperl-calculate-indent': Likewise. Don't special-case REx with non-empty 1st line `cperl-find-pods-heres': In RExen, highlight non-literal backslashes Invert highlighting of charclasses: now the envelop is highlighted Highlight many others 0-length builtins `cperl-praise': Mention indenting and highlight in RExen After 5.15: `cperl-find-pods-heres': Highlight capturing parens in REx After 5.16: `cperl-find-pods-heres': Highlight '|' for alternation Initialize `font-lock-warning-face' if not present `cperl-find-pods-heres': Use `font-lock-warning-face' instead of `font-lock-function-name-face' `cperl-look-at-leading-count': Likewise. `cperl-find-pods-heres': localize `font-lock-variable-name-face' `font-lock-keyword-face' (needed for batch processing) etc Use `font-lock-builtin-face' for builtin in REx Now `font-lock-variable-name-face' is used for interpolated variables Use "talking aliases" for faces inside REx Highlight parts of REx (except in charclasses) according to the syntax and/or semantic Syntax-mark a {}-part of (?{}) as "comment" (it was the ()-part) Better logic to distinguish what is what in REx `cperl-tips-faces': Document REx highlighting `cperl-praise': Mention REx syntax highlight etc. After 5.17: `cperl-find-sub-attrs': Would not always manage to print error message `cperl-find-pods-heres': localize `font-lock-constant-face' After 5.18: `cperl-find-pods-heres': Misprint in REx for parsing REx Very minor optimization `my-cperl-REx-modifiers-face' got quoted Recognize "print $foo <<END" as HERE-doc Put `REx-interpolated' text attribute if needed `cperl-invert-if-unless-modifiers': New function `cperl-backward-to-start-of-expr': Likewise. `cperl-forward-to-end-of-expr': Likewise. `cperl-invert-if-unless': Works in "the opposite way" too Cursor position on return is on the switch-word Indents comments better `REx-interpolated': New text attribute `cperl-next-interpolated-REx': New function `cperl-next-interpolated-REx-0': Likewise. `cperl-next-interpolated-REx-1': Likewise. "\C-c\C-x", "\C-c\C-y", "\C-c\C-v": New keybinding for these functions Perl/Regexp menu: 3 new entries for `cperl-next-interpolated-REx' `cperl-praise': Mention finded interpolated RExen After 5.19: `cperl-init-faces': Highlight %$foo, @$foo too `cperl-short-docs': Better docs for system, exec `cperl-find-pods-heres': Better detect << after print {FH} <<EOF etc. Would not find HERE-doc ended by EOF without NL `cperl-short-docs': Correct not-doubled \-escapes start block: Put some `defvar' for stuff gone from XEmacs After 5.20: initial comment: Extend copyright, fix email address `cperl-indent-comment-at-column-0': New customization variable `cperl-comment-indent': Indentation after $#a would increasy by 1 `cperl-mode': Make `defun-prompt-regexp' grok BEGIN/END etc `cperl-find-pods-heres': Mark CODE of s///e as `syntax-type' `multiline' `cperl-at-end-of-expr': Would fail if @BAR=12 follows after ";" `cperl-init-faces': If `cperl-highlight-variables-indiscriminately' highlight $ in $foo too (UNTESTED) `cperl-set-style': Docstring missed some available styles toplevel: Menubar/Perl/Indent-Styles had FSF, now K&R Change "Current" to "Memorize Current" `cperl-indent-wrt-brace': New customization variable; the default is as for pre-5.2 version `cperl-styles-entries': Keep `cperl-extra-newline-before-brace-multiline' `cperl-style-alist': Likewise. `cperl-fix-line-spacing': Support `cperl-merge-trailing-else' being nil, and `cperl-extra-newline-before-brace' etc being t `cperl-indent-exp': Plans B and C to find continuation blocks even if `cperl-extra-newline-before-brace' is t After 5.21: Improve some docstrings concerning indentation. `cperl-indent-rules-alist': New variable `cperl-sniff-for-indent': New function name (separated from `cperl-calculate-indent') `cperl-calculate-indent': Separated the sniffer and the indenter; uses `cperl-sniff-for-indent' now `cperl-comment-indent': Test for `cperl-indent-comment-at-column-0' was inverted; Support `comment-column' = 0
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 11 Oct 2006 06:47:35 +0000
parents 3661e9b3c48f
children 3e566ec9ef5d c5406394f567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28823
72c6f8275e0b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents: 25216
diff changeset
1 #! /usr/bin/perl
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
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,
68647
3661e9b3c48f Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64769
diff changeset
4 # 2005, 2006 Free Software Foundation, Inc.
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 #
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 # This file is part of GNU Emacs.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 #
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 # GNU Emacs is free software; you can redistribute it and/or modify
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 # it under the terms of the GNU General Public License as published by
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 # the Free Software Foundation; either version 2, or (at your option)
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 # any later version.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 #
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 # GNU Emacs is distributed in the hope that it will be useful,
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 # GNU General Public License for more details.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 #
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 # along with GNU Emacs; see the file COPYING. If not, write to the
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 54324
diff changeset
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 54324
diff changeset
21 # Boston, MA 02110-1301, USA.
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 # Extract entries from ChangeLogs matching specified criteria.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 # Optionally format the resulting output to a form suitable for RCS
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 # 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
27 # author lines, leading spaces, and file names are removed.
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 require 5;
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
30 use strict;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 # Parse command line options.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
34 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
35 $rcs_log $with_date $version $help $reverse
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
36 @entries);
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
37
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 use Getopt::Long;
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
39 my $result = GetOptions ("author=s" => \$author,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
40 "text=s" => \$regexp,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
41 "exclude=s" => \$exclude,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
42 "from-date=s" => \$from_date,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
43 "to-date=s" => \$to_date,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
44 "rcs-log" => \$rcs_log,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
45 "with-date" => \$with_date,
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
46 "reverse!" => \$reverse,
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
47 "version" => \$version,
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
48 "help" => \$help);
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 # If date options are specified, check that they have the format
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 # YYYY-MM-DD.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 # Print usage information and exit when necessary.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 if ($result == 0 || $help) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 print <<USAGE;
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
60
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 Usage: $0 [options] [CHANGELOG...]
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
63 Print entries in ChangeLogs matching various criteria.
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
64 Valid options are:
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
65
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
66 --author=AUTHOR Match entries whose author line matches
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 regular expression AUTHOR
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
68 --text=TEXT Match entries whose text matches regular
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
69 expression TEXT
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
70 --exclude=TEXT Exclude entries matching TEXT
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
71 --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
72 --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
73 --rcs-log Format output suitable for RCS log entries
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
74 --with-date Print short date line in RCS log
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
75 --reverse Show entries in reverse (chronological) order
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
76 --version Print version info
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
77 --help Print this help
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 If no CHANGELOG is specified scan the files "ChangeLog" and
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
80 "ChangeLog.1+" in the current directory. Old-style dates in ChangeLogs
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 are not recognized.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 USAGE
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
83 exit !$help;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 # Print version info and exit if `--version' was specified.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 if ($version) {
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
89 print "0.2\n";
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 exit 0;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 # Value is non-zero if HEADER matches according to command line
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 # options specified, i.e. it matches $author, and its date is in
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 # the range $from_date <= date <= $to_date.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
98 sub header_match_p {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 my $header = shift;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100
38502
180f542bf5b4 (entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents: 38500
diff changeset
101 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
102
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 # No match if AUTHOR-regexp specified and doesn't match.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 return 0 if $author && $header !~ /$author/;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 # Check that the date of the entry matches if date options
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 # `--from-date' and/or `--to-date' were specified . Old-style
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 # dates in ChangeLogs are not recognized, and never match.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 if ($from_date || $to_date) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 if ($header =~ /^(\d\d\d\d-\d\d-\d\d)/) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 my $date = $1;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 return 0 if $from_date && $date lt $from_date;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 return 0 if $to_date && $date gt $to_date;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 } else {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 # Don't bother recognizing old-style dates.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 return 0;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 return 1;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
124 # Value is non-zero if ENTRY matches the criteria specified on the
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 # command line, i.e. it matches $regexp, and it doesn't match
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 # $exclude.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
128 sub entry_match_p {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 my $entry = shift;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130
38502
180f542bf5b4 (entry_match_p, header_match_p): Fix handling of null or empty
Gerd Moellmann <gerd@gnu.org>
parents: 38500
diff changeset
131 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
132
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 if ($regexp) {
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
134 return 1 if ($entry =~ /$regexp/
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 && (!$exclude || $entry !~ $exclude));
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 } else {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 return 1 if !$exclude || $entry !~ $exclude;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 return 0;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 # Print HEADER and/or ENTRY in a format suitable for what was
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 # specified on the command line. If $rcs_log is specified, author
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 # lines are not printed, and leading spaces and file names are removed
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 # from ChangeLog entries.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
149 sub print_log {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 my ($header, $entry) = @_;
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
151 my $output = '';
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 if ($rcs_log) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 # Remove leading whitespace from entry.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 $entry =~ s/^\s+//mg;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 # Remove file name parts.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 $entry =~ s/^\*.*\(/(/mg;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 # Remove file name parts, 2.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 $entry =~ s/^\*.*://mg;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 if ($with_date) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 $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
162 $output = "!changelog-date $1\n";
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 }
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
164 $output .= $entry;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 } else {
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
166 $output .= $header . $entry;
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
167 }
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
168
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
169 if ($reverse) {
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
170 push @entries, $output;
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
171 } else {
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
172 print $output;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 # Scan LOG for matching entries, and print them to standard output.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
178 sub parse_changelog {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 my $log = shift;
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
180 my $entry = undef;
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
181 my $header = undef;
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
182
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
183 @entries = () if $reverse;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 # Open the ChangeLog.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 open (IN, "< $log") || die "Cannot open $log: $!";
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187
38509
59acf1c91dd2 (main, parse_changelog): Make "use strict"-clean.
Gerd Moellmann <gerd@gnu.org>
parents: 38504
diff changeset
188 while (defined(my $line = <IN>)) {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 if ($line =~ /^\S/) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 # Line is an author-line. Print previous entry if
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 # it matches.
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
192 print_log ($header, $entry)
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 if header_match_p ($header) && entry_match_p ($entry);
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 $entry = "";
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 $header = $line;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 # 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
199 while (defined($line = <IN>) && $line =~ /^\s*$/) {
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 $header = "$header$line";
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 }
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
202 }
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203
38504
1d53627a58ae (parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents: 38502
diff changeset
204 last unless defined $line;
1d53627a58ae (parse_changelog): Add another test for defined value to
Gerd Moellmann <gerd@gnu.org>
parents: 38502
diff changeset
205
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 if ($line =~ /^\s*\*/) {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 # LINE is the first line of a ChangeLog entry. Print
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 # previous entry if it matches.
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
209 print_log ($header, $entry)
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 if header_match_p ($header) && entry_match_p ($entry);
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 $entry = $line;
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 } else {
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 # Add LINE to the current entry.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 $entry = "$entry$line";
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 # Print last entry if it matches.
29638
f6a97d806845 Fix typos in comments. Remove trailing blanks.
Jim Meyering <jim@meyering.net>
parents: 28823
diff changeset
219 print_log ($header, $entry)
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 if header_match_p ($header) && entry_match_p ($entry);
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 close IN;
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
223
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
224 if ($reverse) {
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
225 for (my $entry = @entries; $entry; $entry--) {
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
226 print $entries[$entry-1];
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
227 }
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
228 }
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 # Main program. Process ChangeLogs.
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
234 # 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
235 # order supplied by the user; otherwise parse default files ChangeLog and
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
236 # ChangeLog.1+ according to $reverse.
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
237 unless (@ARGV > 0) {
54324
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
238 @ARGV = ("ChangeLog");
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
239
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
240 push @ARGV,
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
241 map {"ChangeLog.$_"}
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
242 sort {$b <=> $a}
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
243 map {/\.(\d+)$/; $1}
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
244 do {
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
245 opendir D, '.';
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
246 grep /^ChangeLog\.\d+$/, readdir D;
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
247 };
bdf4aa3226e7 Changes to support ChangeLog.10+.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
248
38551
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
249 @ARGV = reverse @ARGV if $reverse;
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
250 }
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
251
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
252 while (defined (my $log = shift @ARGV)) {
6bd3c93022e7 (parse_changelog): Remove unused local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 38510
diff changeset
253 parse_changelog ($log) if -f $log;
25216
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 }
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255
40dc181e545b Initial revision
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38551
diff changeset
257 # 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
258 # grep-changelog ends here.