Warning, /sdk/kde-dev-scripts/cvslastchange is written in an unsupported language. File is not indexed.

0001 #! /usr/bin/env perl
0002 
0003 use File::Basename;
0004 
0005 sub usage()
0006 {
0007   print "Usage:\n";
0008   print "  $0 [ <filename > | <filename> <rev> | \n" .
0009         "       M +<digits> -<digits> <filename <rev> ]\n";
0010   print "\n";
0011   
0012   exit 5;
0013 }
0014 
0015 my $filename;
0016 
0017 my $argc = scalar @ARGV;
0018 
0019 if ($argc > 0 and $argc < 3 ) {
0020   $filename = $ARGV[0];
0021   $cvsversion= dirname($0) . "/cvsversion";
0022   $version=`$cvsversion $filename`;
0023   chomp $version;
0024   $version=$ARGV[1] if ($argc > 1 and $ARGV[1] =~ /^[\d\.]{3,}$/);
0025 } elsif ($argc == 5) {
0026   $filename=$ARGV[3] if (-f $ARGV[3]);
0027   $version=$ARGV[4] if ($ARGV[4] =~ /^[\d\.]{3,}$/);
0028 } else {
0029   &usage();
0030 }
0031 
0032 die "$0: filename expected" if(!length($filename));
0033 die "$filename: $!\n" if (! -f $filename);
0034 
0035 my $vold = $version;
0036 my $vnew = $version;
0037 
0038 if ($version=~/^.*\.1$/) {
0039   $vold = $1 if ($version=~/^(\d+\.\d+(?:\.\d+\.\d+)*)\.\d+\.1$/);
0040 }
0041 else {
0042   if ($version=~/^(.*)\.([^.]*)$/) { $v1 = $1; $v2 = $2 } 
0043   $v2old = ${v2}-1;
0044   $vold = $v1 . '.' . $v2old;
0045 }
0046 my $base = basename($filename);
0047 my $dir = dirname($filename);
0048 my $cmd = "cd $dir; cvs -f log -N -r$vnew $base";
0049 print "$cmd\n";
0050 system("$cmd");
0051 my $whitespace = "";
0052 $whitespace = "-b" unless (defined $ENV{"CVSLASTCHANGE_KEEP_WHITESPACE"});
0053 $cmd = "cd $dir; cvs -f diff -kk $whitespace -p -u -r$vold -r$vnew $base";
0054 print "$cmd\n";
0055 system("$cmd");