| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package buildbucket | 5 package buildbucket |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "net/http" | 9 "net/http" |
| 10 "strings" | 10 "strings" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // getChangeList tries to extract CL information from a buildbucket build. | 106 // getChangeList tries to extract CL information from a buildbucket build. |
| 107 func getChangeList( | 107 func getChangeList( |
| 108 build *buildbucket.ApiBuildMessage, params *buildParameters, | 108 build *buildbucket.ApiBuildMessage, params *buildParameters, |
| 109 resultDetails *resultDetails) (result *resp.Commit) { | 109 resultDetails *resultDetails) (result *resp.Commit) { |
| 110 | 110 |
| 111 prop := ¶ms.Properties | 111 prop := ¶ms.Properties |
| 112 switch prop.PatchStorage { | 112 switch prop.PatchStorage { |
| 113 case "rietveld": | 113 case "rietveld": |
| 114 if prop.RietveldURL != "" && prop.Issue != 0 { | 114 if prop.RietveldURL != "" && prop.Issue != 0 { |
| 115 result = &resp.Commit{ | 115 result = &resp.Commit{ |
| 116 » » » » Revision: resultDetails.Properties.GotRev
ision, | 116 » » » » // TODO(hinoka): Figure out the full URL for the
se revisions, add it |
| 117 » » » » RequestRevision: prop.Revision, | 117 » » » » // to the URL field. |
| 118 » » » » Revision: &resp.Link{Label: resultDetails
.Properties.GotRevision}, |
| 119 » » » » RequestRevision: &resp.Link{Label: prop.Revision
}, |
| 118 Changelist: &resp.Link{ | 120 Changelist: &resp.Link{ |
| 119 Label: fmt.Sprintf("Rietveld CL %d", pro
p.Issue), | 121 Label: fmt.Sprintf("Rietveld CL %d", pro
p.Issue), |
| 120 URL: fmt.Sprintf("%s/%d/#ps%d", prop.R
ietveldURL, prop.Issue, prop.PatchSet), | 122 URL: fmt.Sprintf("%s/%d/#ps%d", prop.R
ietveldURL, prop.Issue, prop.PatchSet), |
| 121 }, | 123 }, |
| 122 } | 124 } |
| 123 } | 125 } |
| 124 | 126 |
| 125 case "gerrit": | 127 case "gerrit": |
| 126 if prop.GerritPatchURL != "" && prop.GerritPatchIssue != 0 { | 128 if prop.GerritPatchURL != "" && prop.GerritPatchIssue != 0 { |
| 127 path := fmt.Sprintf("%d", prop.GerritPatchIssue) | 129 path := fmt.Sprintf("%d", prop.GerritPatchIssue) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 } | 140 } |
| 139 } | 141 } |
| 140 | 142 |
| 141 if result != nil && len(params.Changes) != 0 { | 143 if result != nil && len(params.Changes) != 0 { |
| 142 // tryjobs have one change and it is the CL author | 144 // tryjobs have one change and it is the CL author |
| 143 result.AuthorEmail = params.Changes[0].Author.Email | 145 result.AuthorEmail = params.Changes[0].Author.Email |
| 144 } | 146 } |
| 145 | 147 |
| 146 return | 148 return |
| 147 } | 149 } |
| OLD | NEW |