| Index: milo/appengine/job_source/buildbot/build.go
|
| diff --git a/milo/appengine/job_source/buildbot/build.go b/milo/appengine/job_source/buildbot/build.go
|
| index 52bc2e64b8ade8d3db254a86b398b9f284461a20..54114572ca70699e6a686ade491f72cd3945301d 100644
|
| --- a/milo/appengine/job_source/buildbot/build.go
|
| +++ b/milo/appengine/job_source/buildbot/build.go
|
| @@ -13,6 +13,7 @@ import (
|
| "path/filepath"
|
| "regexp"
|
| "sort"
|
| + "strconv"
|
| "strings"
|
| "time"
|
|
|
| @@ -395,10 +396,10 @@ func blame(b *buildbotBuild) (result []*resp.Commit) {
|
| func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| ss := &resp.SourceStamp{}
|
| rietveld := ""
|
| + gerrit := ""
|
| got_revision := ""
|
| repository := ""
|
| issue := int64(-1)
|
| - // TODO(hinoka): Gerrit URLs.
|
| for _, prop := range b.Properties {
|
| switch prop.Name {
|
| case "rietveld":
|
| @@ -408,10 +409,17 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| logging.Warningf(c, "Field rietveld is not a string: %#v", prop.Value)
|
| }
|
| case "issue":
|
| + // Sometime this is a number (float), sometime it is a string.
|
| if v, ok := prop.Value.(float64); ok {
|
| issue = int64(v)
|
| + } else if v, ok := prop.Value.(string); ok {
|
| + if vi, err := strconv.ParseInt(v, 10, 64); err == nil {
|
| + issue = int64(vi)
|
| + } else {
|
| + logging.Warningf(c, "Could not decode field issue: %q - %s", prop.Value, err)
|
| + }
|
| } else {
|
| - logging.Warningf(c, "Field issue is not a float: %#v", prop.Value)
|
| + logging.Warningf(c, "Field issue is not a string or float: %#v", prop.Value)
|
| }
|
|
|
| case "got_revision":
|
| @@ -421,6 +429,20 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| logging.Warningf(c, "Field got_revision is not a string: %#v", prop.Value)
|
| }
|
|
|
| + case "patch_issue":
|
| + if v, ok := prop.Value.(float64); ok {
|
| + issue = int64(v)
|
| + } else {
|
| + logging.Warningf(c, "Field patch_issue is not a float: %#v", prop.Value)
|
| + }
|
| +
|
| + case "patch_gerrit_url":
|
| + if v, ok := prop.Value.(string); ok {
|
| + gerrit = v
|
| + } else {
|
| + logging.Warningf(c, "Field gerrit is not a string: %#v", prop.Value)
|
| + }
|
| +
|
| case "repository":
|
| if v, ok := prop.Value.(string); ok {
|
| repository = v
|
| @@ -428,16 +450,20 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| }
|
| }
|
| if issue != -1 {
|
| - if rietveld != "" {
|
| + switch {
|
| + case rietveld != "":
|
| rietveld = strings.TrimRight(rietveld, "/")
|
| ss.Changelist = resp.NewLink(
|
| - fmt.Sprintf("Issue %d", issue),
|
| - fmt.Sprintf("%s/%d", rietveld, issue),
|
| - )
|
| - } else {
|
| - logging.Warningf(c, "Found issue but not rietveld property.")
|
| + fmt.Sprintf("Rietveld CL %d", issue),
|
| + fmt.Sprintf("%s/%d", rietveld, issue))
|
| + case gerrit != "":
|
| + gerrit = strings.TrimRight(gerrit, "/")
|
| + ss.Changelist = resp.NewLink(
|
| + fmt.Sprintf("Gerrit CL %d", issue),
|
| + fmt.Sprintf("%s/c/%d", gerrit, issue))
|
| }
|
| }
|
| +
|
| if got_revision != "" {
|
| ss.Revision = resp.NewLink(got_revision, "")
|
| if repository != "" {
|
|
|