fix the release ordering on the testsuite page

now Ic-1 Ic-11 I-10 I-2 will be sorted as
    Ic-11 I-10 I-2 Ic-1
This commit is contained in:
Sébastien Loriot 2013-01-23 10:24:30 +01:00
parent e2570a7240
commit 63d0a01743
1 changed files with 6 additions and 9 deletions

View File

@ -47,19 +47,16 @@ sub sort_releases($$)
my $b = $_[0]; my $b = $_[0];
my $a = $_[1]; my $a = $_[1];
my @A = ($a =~ /\d+|Ic?/g); #take only the numbers from release id, skipping I and Ic
my @B = ($b =~ /\d+|Ic?/g); my @A = ($a =~ /\d+/g);
my @B = ($b =~ /\d+/g);
while(@A and @B) { while(@A and @B) {
my $av = shift(@A); my $av = shift(@A);
my $bv = shift(@B); my $bv = shift(@B);
#$av and $bv are integers
if( $av =~ /^\d+$/ and $bv =~ /^\d+$/ ) { if($av == $bv) { next; }
if($av == $bv) { next; } return $av <=> $bv;
else { return $av <=> $bv; }
} else {
return $av cmp $bv
}
} }
return @A <=> @B; return @A <=> @B;
} }