about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwText.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-28 14:56:21 +0000
committerEric Wong <e@80x24.org>2023-11-29 02:13:22 +0000
commit67ecd56a0aaf977fa1a22aa6e2378c9317c72549 (patch)
treeedb6e7d87ab1bc1b05bde1e5eb07d9b1ccab6a21 /lib/PublicInbox/WwwText.pm
parent10b23966ff8fa35a112f7fe2b9386dd4967d818c (diff)
downloadpublic-inbox-67ecd56a0aaf977fa1a22aa6e2378c9317c72549.tar.gz
This is a major step in solving the problem of having to
manually associate hundreds/thousands of coderepos with
hundreds/thousands of public-inboxes to power solver
(and more).
Diffstat (limited to 'lib/PublicInbox/WwwText.pm')
-rw-r--r--lib/PublicInbox/WwwText.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index f4508b3f..4b4b2e4c 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -7,7 +7,7 @@ use strict;
 use v5.10.1;
 use PublicInbox::Linkify;
 use PublicInbox::WwwStream;
-use PublicInbox::Hval qw(ascii_html prurl);
+use PublicInbox::Hval qw(ascii_html prurl fmt_ts);
 use HTTP::Date qw(time2str);
 use URI::Escape qw(uri_escape_utf8);
 use PublicInbox::GzipFilter qw(gzf_maybe);
@@ -248,14 +248,23 @@ EOS
 
 sub coderepos_raw ($$) {
         my ($ctx, $top_url) = @_;
-        my $cr = $ctx->{ibx}->{coderepo} // return ();
         my $cfg = $ctx->{www}->{pi_cfg};
+        my $cr = $cfg->repo_objs($ctx->{ibx}) or return ();
         my $buf = 'Code repositories for project(s) associated with this '.
-                $ctx->{ibx}->thing_type . "\n";
-        for my $git (@{$ctx->{www}->{pi_cfg}->repo_objs($ctx->{ibx})}) {
+                $ctx->{ibx}->thing_type . ":\n";
+        my @recs = map { [ 0, $_ ] } @$cr;
+        my @todo = @recs;
+        $cfg->each_cindex('load_commit_times', \@todo);
+        @recs = sort { $b->[0] <=> $a->[0] } @recs;
+        my $cr_score = $ctx->{ibx}->{-cr_score};
+        for (@recs) {
+                my ($t, $git) = @$_;
                 for ($git->pub_urls($ctx->{env})) {
                         my $u = m!\A(?:[a-z\+]+:)?//!i ? $_ : $top_url.$_;
-                        $buf .= "\n\t" . prurl($ctx->{env}, $u);
+                        my $nr = $cr_score->{$git->{nick}};
+                        $buf .= "\n";
+                        $buf .= $nr ? sprintf('% 9u', $nr) : (' 'x9);
+                        $buf .= ' '.fmt_ts($t).' '.prurl($ctx->{env}, $u);
                 }
         }
         ($buf);