--- /dev/null
+#!/usr/bin/perl
+
+@ARGV == 1 or die "Usage: mo-merge <task>\n";
+my $task = $ARGV[0];
+foreach my $s (`ls -d testing/*/$task`) {
+ chomp $s;
+ if (! -s "$s/points.old") {
+ if (-s "$s/points") {
+ rename "$s/points", "$s/points.old" or die "Rename $s/points failed: $!";
+ } else {
+ print "$s: NO POINTS?\n";
+ next;
+ }
+ }
+ open X, "$s/points.old" or die;
+ my %tests = ();
+ my %cmts = ();
+ while (<X>) {
+ chomp;
+ my ($test, $subtest, $pts, $cmt) = /^(\d+)([a-z]*)\s+(\d+)\s*(.*)/ or die;
+ if (!exists($tests{$test}) || $tests{$test} > $pts) {
+ $tests{$test} = $pts;
+ $cmts{$test} = $cmt;
+ }
+ }
+ close X;
+ open X, ">$s/points" or die;
+ foreach my $test (sort { $a <=> $b } keys %tests) {
+ print X "$test $tests{$test} $cmts{$test}\n";
+ }
+ close X;
+}