From 6dde7e380cdf94948d72f95dc16ef355afbb4299 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 10 Aug 1999 13:33:49 +0000 Subject: [PATCH] Initial revision --- lib-src/grep-changelog | 220 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100755 lib-src/grep-changelog diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog new file mode 100755 index 0000000000..7c1b92dbb4 --- /dev/null +++ b/lib-src/grep-changelog @@ -0,0 +1,220 @@ +#! /usr/local/bin/perl +# $Id: grep-changelog,v 1.19 1999/08/10 13:22:23 gerd Exp $ + +# Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU Emacs. +# +# GNU Emacs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Emacs; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + + +# 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. + +require 5; + +# Parse command line options. + +use Getopt::Long; +$result = GetOptions ("author=s" => \$author, + "text=s" => \$regexp, + "exclude=s" => \$exclude, + "from-date=s" => \$from_date, + "to-date=s" => \$to_date, + "rcs-log" => \$rcs_log, + "with-date" => \$with_date, + "version" => \$version, + "help" => \$help); + +# If date options are specified, check that they have the format +# YYYY-MM-DD. + +$result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; +$result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; + +# Print usage information and exit when necessary. + +if ($result == 0 || $help) { + print <) { + if ($line =~ /^\S/) { + # Line is an author-line. Print previous entry if + # it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + + $entry = ""; + $header = $line; + + # Add empty lines below the header. + while (($line = ) && $line =~ /^\s*$/) { + $header = "$header$line"; + } + } + + if ($line =~ /^\s*\*/) { + # LINE is the first line of a ChangeLog entry. Print + # previous entry if it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + $entry = $line; + } else { + # Add LINE to the current entry. + $entry = "$entry$line"; + } + } + + # Print last entry if it matches. + print_log ($header, $entry) + if header_match_p ($header) && entry_match_p ($entry); + + close IN; +} + + +# Main program. Process ChangeLogs. + +if (@ARGV > 0) { + # If files were specified on the command line, parse those files. + while ($log = shift @ARGV) { + parse_changelog ($log); + } +} else { + # Parse default files ChangeLog and ChangeLog.9...ChangeLog.1 in + # that order. + parse_changelog ("ChangeLog"); + for ($i = 9; $i >= 1; --$i) { + my $log = "ChangeLog.$i"; + parse_changelog ($log) if -f $log; + } +} + + +# gre-changelog ends here. -- 2.20.1