X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/3c88ae74e34006744f0ac847cf4c4b624b9dd902..f2260f48b09bc32ae620f26e797b85165152baf8:/lib-src/grep-changelog diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog index bfd21c3f93..38fce879c7 100755 --- a/lib-src/grep-changelog +++ b/lib-src/grep-changelog @@ -1,6 +1,6 @@ #! /usr/bin/perl -# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. # # This file is part of GNU Emacs. # @@ -23,7 +23,7 @@ # Extract entries from ChangeLogs matching specified criteria. # Optionally format the resulting output to a form suitable for RCS # logs, like they are used in Emacs, for example. In this format, -# author lines leading spaces, and file names are removed. +# author lines, leading spaces, and file names are removed. require 5; use strict; @@ -31,7 +31,8 @@ use strict; # Parse command line options. use vars qw($author $regexp $exclude $from_date $to_date - $rcs_log $with_date $version $help); + $rcs_log $with_date $version $help $reverse + @entries); use Getopt::Long; my $result = GetOptions ("author=s" => \$author, @@ -41,6 +42,7 @@ my $result = GetOptions ("author=s" => \$author, "to-date=s" => \$to_date, "rcs-log" => \$rcs_log, "with-date" => \$with_date, + "reverse!" => \$reverse, "version" => \$version, "help" => \$help); @@ -54,33 +56,36 @@ $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; if ($result == 0 || $help) { print < 0) { - # If files were specified on the command line, parse those files. - while (defined(my $log = shift @ARGV)) { - parse_changelog ($log); - } -} else { - # Parse default files ChangeLog and ChangeLog.9...ChangeLog.1 in - # that order. - parse_changelog ("ChangeLog"); - for (my $i = 9; $i >= 1; --$i) { - my $log = "ChangeLog.$i"; - parse_changelog ($log) if -f $log; - } +# If files were specified on the command line, parse those files in the +# order supplied by the user; otherwise parse default files ChangeLog and +# ChangeLog.1+ according to $reverse. +unless (@ARGV > 0) { + @ARGV = ("ChangeLog"); + + push @ARGV, + map {"ChangeLog.$_"} + sort {$b <=> $a} + map {/\.(\d+)$/; $1} + do { + opendir D, '.'; + grep /^ChangeLog\.\d+$/, readdir D; + }; + + @ARGV = reverse @ARGV if $reverse; +} + +while (defined (my $log = shift @ARGV)) { + parse_changelog ($log) if -f $log; } +# arch-tag: 9e4f6749-e053-4bb7-b3ad-11947318418e # grep-changelog ends here.