···33import (44 "cmp"55 "database/sql"66+ "errors"67 "fmt"78 "maps"89 "slices"···231230 p.Submissions = submissions232231 }233232 }233233+234234 // collect allLabels for each issue235235 allLabels, err := GetLabels(e, FilterIn("subject", pullAts))236236 if err != nil {···240238 for pullAt, labels := range allLabels {241239 if p, ok := pulls[pullAt]; ok {242240 p.Labels = labels241241+ }242242+ }243243+244244+ // collect pull source for all pulls that need it245245+ var sourceAts []syntax.ATURI246246+ for _, p := range pulls {247247+ if p.PullSource.RepoAt != nil {248248+ sourceAts = append(sourceAts, *p.PullSource.RepoAt)249249+ }250250+ }251251+ sourceRepos, err := GetRepos(e, 0, FilterIn("at_uri", sourceAts))252252+ if err != nil && !errors.Is(err, sql.ErrNoRows) {253253+ return nil, fmt.Errorf("failed to get source repos: %w", err)254254+ }255255+ sourceRepoMap := make(map[syntax.ATURI]*models.Repo)256256+ for _, r := range sourceRepos {257257+ sourceRepoMap[r.RepoAt()] = &r258258+ }259259+ for _, p := range pulls {260260+ if p.PullSource.RepoAt != nil {261261+ if sourceRepo, ok := sourceRepoMap[*p.PullSource.RepoAt]; ok {262262+ p.PullSource.Repo = sourceRepo263263+ }243264 }244265 }245266