Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: golden/go/search/trybots.go

Issue 1409103004: Extend Trybot list view (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « golden/go/goldingester/testdata/dm.json ('k') | golden/go/trybot/trybot.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: golden/go/search/trybots.go
diff --git a/golden/go/search/trybots.go b/golden/go/search/trybots.go
index 5d1cc9c66049aaedeb25eadedff32d4ebccc12f6..bff6ed24663bbf1e1dc4c682b2ca284860412a27 100644
--- a/golden/go/search/trybots.go
+++ b/golden/go/search/trybots.go
@@ -2,6 +2,7 @@ package search
import (
"fmt"
+ "sort"
"strconv"
"strings"
"sync"
@@ -13,11 +14,12 @@ import (
// TrybotIssue is the output structure for a Rietveld issue that has
// trybot runs assoicated with it.
type TrybotIssue struct {
- ID int64 `json:"id"`
- Subject string `json:"subject"`
- Owner string `json:"owner"`
- Updated int64 `json:"updated"`
- URL string `json:"url"`
+ ID int64 `json:"id"`
+ Subject string `json:"subject"`
+ Owner string `json:"owner"`
+ Updated int64 `json:"updated"`
+ URL string `json:"url"`
+ CurrentPatchset int `json:"currentPatchset"`
}
// ListTrybotIssues returns the most recently updated trybot issues in reverse
@@ -44,7 +46,7 @@ func ListTrybotIssues(storages *storage.Storage, offset, size int) ([]*TrybotIss
go func(issueInfo *trybot.IssueListItem) {
defer wg.Done()
- intIssueId, err := strconv.Atoi(issueInfo.Issue)
+ intIssueId, err := strconv.ParseInt(issueInfo.Issue, 10, 64)
if err != nil {
ch <- fmt.Errorf("Unable to parse issue id %s. Got error: %s", issueInfo.Issue, err)
return
@@ -55,12 +57,24 @@ func ListTrybotIssues(storages *storage.Storage, offset, size int) ([]*TrybotIss
return
}
+ // Retrieve the owner via the patchset via Rietveld.
+ owner := result.Owner
+ if len(result.Patchsets) > 0 {
+ ps, err := storages.RietveldAPI.GetPatchset(intIssueId, result.Patchsets[0])
+ if err != nil {
+ ch <- fmt.Errorf("Error retrieving patchset %d for issue %s: %s", result.Patchsets[0], issueInfo.Issue, err)
+ return
+ }
+ owner = ps.OwnerEmail
+ }
+
ret := &TrybotIssue{
- ID: result.Issue,
- Owner: result.Owner,
- Subject: result.Subject,
- Updated: result.Modified.Unix(),
- URL: strings.TrimSuffix(storages.RietveldAPI.Url(), "/") + fmt.Sprintf("/%d", result.Issue),
+ ID: result.Issue,
+ Owner: owner,
+ Subject: result.Subject,
+ Updated: result.Modified.Unix(),
+ URL: strings.TrimSuffix(storages.RietveldAPI.Url(), "/") + fmt.Sprintf("/%d", result.Issue),
+ CurrentPatchset: sort.Search(len(result.Patchsets), func(i int) bool { return result.Patchsets[i] >= issueInfo.MaxPatchset }) + 1,
}
mutex.Lock()
« no previous file with comments | « golden/go/goldingester/testdata/dm.json ('k') | golden/go/trybot/trybot.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698