update dev300-m58
[ooovba.git] / sc / source / ui / vba / testvba / timestampsClean.pl
blob2c947d0cc6d50a9b51eafeef0acad7d4bde8e01e
1 #!/usr/bin/perl -w
3 my @output_buffer = ();
4 my $fname;
5 my $detectedSomeGuff = 0;
6 sub pure_guff($)
8 my $array = shift;
9 my @lines = @{$array};
10 my $contains_sense = '';
11 my $contains_guff = '';
12 while (scalar @lines)
14 my $line = pop @lines;
15 if ($line =~ m/Test run started :/ ||
16 $line =~ m/ITEM Assertion OK/ ||
17 $line =~ m/Test run finished :/) {
18 $contains_guff = '1';
19 } elsif ($line =~ m/^[\+\-][^\-\+]/) {
20 $contains_sense = '1';
23 if ($contains_guff && $contains_sense) {
24 print STDERR "Patch fragment with mixed good/bad changes in '$ARGV' near $line_index\n";
25 $contains_guff = '';
27 elsif ( $contains_guff ) {
28 $detectedSomeGuff++;
30 # print "contains guff: $contains_guff\n";
31 return $contains_guff;
34 sub output_lines($)
36 my $array = shift;
37 my @lines = @{$array};
39 if (pure_guff (\@lines)) {
40 return;
43 while (scalar @lines)
45 my $line = pop @lines;
46 push @output_buffer, $line;
50 my $header;
51 my @lines;
52 my $frag_count = 0;
53 $line_index = 0;
55 while (<>) {
56 if (/^\@\@/ || /^[^ \-\+]/) {
57 output_lines (\@lines);
58 @lines = ();
59 $frag_count++;
61 unshift @lines, $_;
62 $line_index++;
63 close ARGV if eof;
65 output_lines(\@lines);
67 # $detectedSomeGuff contains the skipped hunks that contain acceptable diff
68 # e.g. a timestamp or an OK assertion that contains different content
69 # like perhaps a path
70 #print "frag_count = $frag_count fragstocount = $fragstocount detectedSomeGuff = $detectedSomeGuff \n";
71 if ($frag_count > $detectedSomeGuff) {
72 print @output_buffer;