summaryrefslogtreecommitdiffstats
path: root/scripts/cvslastreferenced
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cvslastreferenced')
-rwxr-xr-xscripts/cvslastreferenced64
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/cvslastreferenced b/scripts/cvslastreferenced
new file mode 100755
index 00000000..666a5b6d
--- /dev/null
+++ b/scripts/cvslastreferenced
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+# Written by Zack Rusin <zack@kde.org>
+#
+# This file is free software, licensed under the BSD licence.
+# That means that you can do anything you want with it except
+# eating too much candy since that totally messes up your teeth
+# and here in KDE land we care about your teeth. They're out
+# greatest priority right next to scoring chicks of course...
+#
+
+# This script goes through the whole history of a file to find
+# all modifications referencing specific string. It's useful if
+# you want to know when a function has been removed/modified/added
+# to a file if a recent cvs annotate doesn't anymore reference it.
+
+our $file;
+our $func;
+
+sub check_file
+{
+ my $rev1 = shift;
+ my $rev2 = shift;
+
+ my $output = `cvs diff -r $rev1 -r $rev2 $file`;
+
+ if ( $output =~ /(^[+-].+$func.+$)/m ) {
+ print "FOUND IN: cvs diff -r $rev1 -r $rev2 $file\n";
+ $_ = $1;
+ s/^([-+])\s*(.+)/$1 $2/;
+ return $_;
+ }
+ return 0;
+}
+
+sub get_revision
+{
+ my $output = `cvsversion $file`;
+ chomp $output;
+ return $output;
+}
+
+my $argc = scalar @ARGV;
+
+die "$0 <function> <file>" if ( $argc != 2 );
+$func = $ARGV[0];
+$file = $ARGV[1];
+
+my $current_revision = get_revision( $file );
+
+$current_revision =~ /(\d+)\.(\d+)/;
+$base = $1;
+$working = $2;
+
+while ( $working > 1 ) {
+ my $older = $working - 1;
+ my $res = check_file( "$base.$older", "$base.$working");
+
+ if ( $res ) {
+ print "\t($res)\n";
+ }
+ --$working;
+}
+
+print "Didn't find a reference to that $func in $file\n";