From ea27af285a3d32101bdc52ff4a8ff9cdebd4b256 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Jul 2002 16:22:37 +0000 Subject: simple perl script for retreiving cvs log messages for a file after a given date. I use it to help update the WHATSNEW.txt for a release. ./cvslog.pl SAMBA_2_2 '>2002-06-18' configure.in The output is a little messy right now, but I plan to clean that up. (This used to be commit 8812223e2a37b0d0f143fcc74c6ba85ac8081ffb) --- source3/script/cvslog.pl | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 source3/script/cvslog.pl (limited to 'source3/script/cvslog.pl') diff --git a/source3/script/cvslog.pl b/source3/script/cvslog.pl new file mode 100755 index 0000000000..f3d020aa72 --- /dev/null +++ b/source3/script/cvslog.pl @@ -0,0 +1,102 @@ +#!/usr/bin/perl -w + +my ( $tag, $filename, $date ); +my ( $tmp, $change_flag ); + +if ( $#ARGV != 2 ) { + + print "Usage: ", $0, " cvstag date file\n"; + exit 1; +} + +$tag = $ARGV[0]; +$date = $ARGV[1]; +$filename = $ARGV[2]; + +print STDERR "$filename\n"; + +open ( CVSLOG, "cvs log -d\"$date\" $filename |" ) || die $!; + +## +## First get the branch revision number +## +undef $revision; +while ( !defined($revision) ) { + if ( eof( \*CVSLOG ) ) { + print STDERR "Premature end of cvs log output!\n"; + exit (1); + } + + $string = ; + chomp( $string ); + + if ( $string =~ /$tag:/ ) { + ( $tmp, $revision ) = split( /:/, $string ); + $revision =~ s/\s+//g; + $revision =~ s/\.0\./\./g; + } +} + +## +## Setup the beginning of the first record +## +$string = ""; +while ( $string !~ /^-+/ ) { + $string = ; + exit(0) if ( eof(\*CVSLOG) ); +} + +## +## Loop starting at the revision number for the entry +## + +while ( $string = ) { + + ($tmp, $entry_rev) = split( /\s+/, $string ); + if ( equal_revision( $revision, $entry_rev ) ) { + if ( ! defined($change_flag) ) { + print "++++++++++++++++++++++++++++++++++++++++++++++++++\n"; + print "## $filename\n"; + print "++\n"; + $change_flag = 1; + } + + while ( $string !~ /^-+/ && !eof(CVSLOG) ) { + print "$string"; + $string = ; + } + } + else { + while ( ($string !~ /^-+/) && !eof(CVSLOG) ) { + $string = ; + } + } +} + +close( CVSLOG ); +exit 0; + +############################################################## +## +sub equal_revision { + my ( $branch, $newfile ) = @_; + my ( $indx ); + my ( @branch_rev, @file_rev ); + + @branch_rev = split( /\./, $branch ); + @file_rev = split( /\./, $newfile ); + + return 0 if ( $#branch_rev != ($#file_rev - 1) ); + + $indx = 0; + while( $indx <= $#branch_rev ) { + if ( $branch_rev[$indx] != $file_rev[$indx] ) { + return 0; + } + $indx++; + } + + return 1; +} + + -- cgit