[PR] index: add a branch selector (PR #5)

Kacper Michajłow via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178657430705.59.14391488141921179611@29965ddac10e>
PR #5 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/fateserver/pulls/5
Patch URL: https://code.ffmpeg.org/FFmpeg/fateserver/pulls/5.patch


From e8fbccc9e4f9c0e143242d179971487c486f877e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 11 Aug 2026 23:59:25 +0200
Subject: [PATCH 1/2] index: add a branch selector
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reports carry the branch since header version 1 and fate-recv.sh tracks
the known branches. The UI mixed all branches into one table with no
way to tell them apart. Add a line of links filtering by branch through
the standard criteria mechanism, so it combines with sorting and other
filters. Reports without a branch count as master, and release/ names
are shortened the same way the branches file does.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 FATE.pm   |  4 ++++
 fate.css  |  8 ++++++++
 index.cgi | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/FATE.pm b/FATE.pm
index 6c1de15..1f7a946 100644
--- a/FATE.pm
+++ b/FATE.pm
@@ -70,6 +70,10 @@ sub split_header {
     } elsif ($hdr[1] ne '0') {
       return undef;
     }
+    # v0 reports have no branch field. Normalize the rest like the branches
+    # file fate-recv.sh keeps.
+    $parsed->{'branch'} = 'master' if not $parsed->{'branch'};
+    $parsed->{'branch'} =~ s,^release/,v,;
     return $parsed;
 }
 
diff --git a/fate.css b/fate.css
index cd73f6b..a9981d7 100644
--- a/fate.css
+++ b/fate.css
@@ -34,6 +34,14 @@
 .fate-alert { color: #911; }
 .rejoice { color: #191; }
 
+#branches a, #branches .branch-active {
+    margin-right: 0.8em;
+}
+
+#branches .branch-active {
+    font-weight: bold;
+}
+
 #failometer {
     padding: 0;
 }
diff --git a/index.cgi b/index.cgi
index d33fb1c..f41d507 100755
--- a/index.cgi
+++ b/index.cgi
@@ -59,6 +59,7 @@ closedir D;
 my @reps;
 my $allpass = 0;
 my $allfail = 0;
+my %branch_seen;
 
 for my $slot (@slots) {
     ($slot) = $slot =~ /^([A-Za-z0-9_\-.]{1,80})\z/ or next;
@@ -66,6 +67,8 @@ for my $slot (@slots) {
     my $rep = load_summary $slot, 'latest' or next;
     next if time - parse_date($$rep{date}) > $hidden_age;
 
+    $branch_seen{$$rep{branch}}++;
+
     my $not_matched = 0;
     $$rep{subarch} = $$rep{arch} if not $$rep{subarch};
     for my $this_query (@queries) {
@@ -221,6 +224,39 @@ head2;
 print "FATE\n";
 head3;
 
+sub branch_cmp {
+    my $r = ($b eq 'master') <=> ($a eq 'master');
+    return $r if $r;
+    my @av = $a =~ /(\d+)/g;
+    my @bv = $b =~ /(\d+)/g;
+    while (@av or @bv) {
+        $r = (shift(@bv) || 0) <=> (shift(@av) || 0);
+        return $r if $r;
+    }
+    return $a cmp $b;
+}
+
+# Branch selector, not shown when only single branch reports are available.
+my ($cur_branch) = map $$_[1], grep $$_[0] eq 'branch', @queries;
+my @branches = sort branch_cmp keys %branch_seen;
+if (@branches > 1) {
+    start 'p', id => 'branches';
+    print 'Branch: ';
+    for my $branch ('all', @branches) {
+        my @rest = grep $$_[0] ne 'branch', @queries;
+        my $active = defined $cur_branch ? $branch eq $cur_branch : $branch eq 'all';
+        if ($active) {
+            span encode_entities($branch, '<>&"'), class => 'branch-active';
+        } else {
+            anchor encode_entities($branch, '<>&"'),
+                href => '?' . join '&amp;', other_params(),
+                    query_params(@rest, $branch eq 'all' ? () : ['branch', $branch]);
+        }
+        print "\n";
+    }
+    end 'p';
+}
+
 if (@queries) {
     start 'p';
     print 'Search patterns: ';
-- 
2.52.0


From f1f5611f6bd3ea19a1abd738237068cc2fd35223 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Thu, 13 Aug 2026 00:29:15 +0200
Subject: [PATCH 2/2] index: sort by result first
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The failures are the most interesting thing on the status page, so put
failed jobs at the top. This puts `result` as first in fallback sort
list. So it will be used by default and as a tie-breaker for explicit
sort.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 index.cgi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.cgi b/index.cgi
index f41d507..e585c4e 100755
--- a/index.cgi
+++ b/index.cgi
@@ -119,7 +119,7 @@ $allpass = pct($allpass, $nreps);
 $allfail = pct($allfail, $nreps);
 $warn    = pct($warn,    $nreps);
 
-my @sort = ('subarch', 'os', 'cc', 'comment', 'slot');
+my @sort = ('result', 'subarch', 'os', 'cc', 'comment', 'slot');
 defined $sort and unshift @sort, split /\/\//, $sort;
 $sort ||= $sort[0];
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.