Snapshot - not functional.

This commit is contained in:
hjp 2000-02-08 16:13:55 +00:00
parent ccffaf3502
commit 2b98426a4e
1 changed files with 63 additions and 0 deletions

63
cvsdiffmin/cvsdiffmin Executable file
View File

@ -0,0 +1,63 @@
#!/usr/local/bin/perl -w
#
# $Id: cvsdiffmin,v 1.1 2000-02-08 16:13:55 hjp Exp $
#
# cvsdiffmin - minimize output of cvs diff
#
use strict;
use File::Slurp;
my $diff = "/usr/local/bin/diff";
my $state = 'EQ';
my %text = ();
my %cap = ();
my $count = 0;
local $| = 1;
while (<>) {
print STDERR;
if ($state eq 'EQ' && /^\<{7} /) {
print STDERR "-> V1\n";
$state = 'V1';
$text{$state} = "";
$cap{$state} = $_;
next;
}
if ($state eq 'V1' && /^\={7}$/) {
print STDERR "-> V2\n";
$state = 'V2';
$text{$state} = "";
next;
}
if ($state eq 'V2' && /^\>{7} /) {
$cap{$state} = $_;
write_file("cvsdiffmin.$$.$count.1", $text{V1});
write_file("cvsdiffmin.$$.$count.2", $text{V2});
system ($diff,
"--unchanged-group-format=\%=\n",
"--changed-group-format=${cap{V1}}\n\%<\n=======\n\%>\n${cap{V2}}\n",
"cvsdiffmin.$$.$count.1",
"cvsdiffmin.$$.$count.2");
print STDERR "-> EQ\n";
$state = 'EQ';
$count++;
next;
}
if ($state eq 'EQ') {
print;
} else {
$text{$state} .= $_;
}
}
print "$state\n";
# vim:sw=4