releaseAutomation/mercurialComparison.pl
changeset 107 b51d77004ea8
parent 87 97b833888afe
child 143 e4ad889f1aa5
equal deleted inserted replaced
106:be1e3961af1c 107:b51d77004ea8
    63 	# Accumulate the total number of files in the old revision of the pkg
    63 	# Accumulate the total number of files in the old revision of the pkg
    64 	$cookedData{$datum->{Package}}->{totalFiles} += $datum->{Count} unless $datum->{Change} eq "A";
    64 	$cookedData{$datum->{Package}}->{totalFiles} += $datum->{Count} unless $datum->{Change} eq "A";
    65 	$cookedData{$datum->{Package}}->{same} += $datum->{Count} if $datum->{Change} eq "same";
    65 	$cookedData{$datum->{Package}}->{same} += $datum->{Count} if $datum->{Change} eq "same";
    66 	$cookedData{$datum->{Package}}->{addRemove} += $datum->{Count} if $datum->{Change} =~ m{^[AR]$};
    66 	$cookedData{$datum->{Package}}->{addRemove} += $datum->{Count} if $datum->{Change} =~ m{^[AR]$};
    67 }
    67 }
    68 # Add the "exception" packages
       
    69 foreach my $package (@pkgErrors)
       
    70 {
       
    71 	chomp $package;
       
    72 	$package =~ s{No valid comparison for }{};
       
    73 	$cookedData{$package}->{exception} = "* Package is brand new, or converted from SFL -> EPL, or has transitioned from FCL back to MCL (not covered in this section)\n";
       
    74 }
       
    75 
       
    76 # Cut-off for "interesting" packages
    68 # Cut-off for "interesting" packages
    77 
       
    78 foreach my $package (keys %cookedData)
    69 foreach my $package (keys %cookedData)
    79 {
    70 {
    80 	# Ensure items are defined
    71 	# Ensure items are defined
    81 	$cookedData{$package}->{totalFiles} |= 1;
    72 	$cookedData{$package}->{totalFiles} |= 1;
    82 	$cookedData{$package}->{same} |= 0;
    73 	$cookedData{$package}->{same} |= 0;
    83 	$cookedData{$package}->{addRemove} |= 0;
    74 	$cookedData{$package}->{addRemove} |= 0;
    84 	$cookedData{$package}->{percentChurn} = 100 * (1 - ($cookedData{$package}->{same} / $cookedData{$package}->{totalFiles}));
    75 	$cookedData{$package}->{percentChurn} = 100 * (1 - ($cookedData{$package}->{same} / $cookedData{$package}->{totalFiles}));
    85 	$cookedData{$package}->{exception} |= "";
       
    86 	
    76 	
    87 	# More than N files added + removed
    77 	# More than N files added + removed
    88 	next if $cookedData{$package}->{addRemove} >= 400;
    78 	next if $cookedData{$package}->{addRemove} >= 400;
    89 	# More than M% churn
    79 	# More than M% churn
    90 	next if $cookedData{$package}->{percentChurn} > 30;
    80 	next if $cookedData{$package}->{percentChurn} > 30;
    91 	# Unable to compare at all
       
    92 	next if $cookedData{$package}->{exception};
       
    93 	# Nothing interesting about this package
    81 	# Nothing interesting about this package
    94 	delete $cookedData{$package};
    82 	delete $cookedData{$package};
    95 }
    83 }
    96 
    84 
    97 # Output
    85 # Output
   100 	print <<"EOT";
    88 	print <<"EOT";
   101 === $package ===
    89 === $package ===
   102 
    90 
   103 * $cookedData{$package}->{addRemove} files added/removed
    91 * $cookedData{$package}->{addRemove} files added/removed
   104 * $cookedData{$package}->{percentChurn}% churn
    92 * $cookedData{$package}->{percentChurn}% churn
   105 $cookedData{$package}->{exception}
    93 
   106 # Cause1
    94 # Cause1
   107 # etc
    95 # etc
   108 
    96 
   109 EOT
    97 EOT
   110 }
    98 }