summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2005-02-07 07:55:00 +0000
committerdes <des@FreeBSD.org>2005-02-07 07:55:00 +0000
commit9ecd4e2559c625dacbe60ce8a31690f1065c61d7 (patch)
tree9fb4f83ea5dceccdccce0082a249dd6790f00156 /tools
parent92a5e4fdd6e689f9a8570f20066b1db264ded799 (diff)
downloadFreeBSD-src-9ecd4e2559c625dacbe60ce8a31690f1065c61d7.zip
FreeBSD-src-9ecd4e2559c625dacbe60ce8a31690f1065c61d7.tar.gz
Sort branches in correct numeric order.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/tinderbox/www/index.cgi27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/tools/tinderbox/www/index.cgi b/tools/tools/tinderbox/www/index.cgi
index 73d24b9..543e9b8 100644
--- a/tools/tools/tinderbox/www/index.cgi
+++ b/tools/tools/tinderbox/www/index.cgi
@@ -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>
";
OpenPOWER on IntegriCloud