mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 08:09:08 +00:00
Sort branches in correct numeric order.
This commit is contained in:
parent
ae9eed1281
commit
f07bfd38ec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=141438
@ -54,6 +54,31 @@ sub success($) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub branch_sort($$) {
|
||||
my ($a, $b) = @_;
|
||||
|
||||
my @a = split('_', $a);
|
||||
my @b = split('_', $b);
|
||||
while (@a || @b) {
|
||||
($a, $b) = (shift(@a), shift(@b));
|
||||
return 1 unless defined($a);
|
||||
return -1 unless defined($b);
|
||||
next if $a eq $b;
|
||||
if ($a =~ m/^\d+$/ && $b =~ m/^\d+$/) {
|
||||
return $a <=> $b;
|
||||
} else {
|
||||
return $a cmp $b;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub inverse_branch_sort($$) {
|
||||
my ($a, $b) = @_;
|
||||
|
||||
return branch_sort($b, $a);
|
||||
}
|
||||
|
||||
sub do_config($) {
|
||||
my $config = shift;
|
||||
|
||||
@ -75,7 +100,7 @@ sub do_config($) {
|
||||
|
||||
my $now = time();
|
||||
|
||||
foreach my $branch (sort(keys(%branches))) {
|
||||
foreach my $branch (sort(inverse_branch_sort keys(%branches))) {
|
||||
my $html = " <tr>
|
||||
<th>$branch</th>
|
||||
";
|
||||
|
Loading…
Reference in New Issue
Block a user