| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. | 1 // Copyright 2016 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // Also take this oppertunity to sort the properties within the
groups. | 381 // Also take this oppertunity to sort the properties within the
groups. |
| 382 sort.Sort(group) | 382 sort.Sort(group) |
| 383 result = append(result, group) | 383 result = append(result, group) |
| 384 } | 384 } |
| 385 return | 385 return |
| 386 } | 386 } |
| 387 | 387 |
| 388 // blame extracts the commit and blame information from a buildbot build and | 388 // blame extracts the commit and blame information from a buildbot build and |
| 389 // returns it as a list of Commits. | 389 // returns it as a list of Commits. |
| 390 func blame(b *buildbotBuild) (result []*resp.Commit) { | 390 func blame(b *buildbotBuild) (result []*resp.Commit) { |
| 391 » for _, c := range b.Sourcestamp.Changes { | 391 » if b.Sourcestamp != nil { |
| 392 » » files := c.GetFiles() | 392 » » for _, c := range b.Sourcestamp.Changes { |
| 393 » » result = append(result, &resp.Commit{ | 393 » » » files := c.GetFiles() |
| 394 » » » AuthorEmail: c.Who, | 394 » » » result = append(result, &resp.Commit{ |
| 395 » » » Repo: c.Repository, | 395 » » » » AuthorEmail: c.Who, |
| 396 » » » CommitTime: time.Unix(int64(c.When), 0).UTC(), | 396 » » » » Repo: c.Repository, |
| 397 » » » Revision: resp.NewLink(c.Revision, c.Revlink), | 397 » » » » CommitTime: time.Unix(int64(c.When), 0).UTC(), |
| 398 » » » Description: c.Comments, | 398 » » » » Revision: resp.NewLink(c.Revision, c.Revlink)
, |
| 399 » » » Title: strings.Split(c.Comments, "\n")[0], | 399 » » » » Description: c.Comments, |
| 400 » » » File: files, | 400 » » » » Title: strings.Split(c.Comments, "\n")[0], |
| 401 » » }) | 401 » » » » File: files, |
| 402 » » » }) |
| 403 » » } |
| 402 } | 404 } |
| 403 return | 405 return |
| 404 } | 406 } |
| 405 | 407 |
| 406 // sourcestamp extracts the source stamp from various parts of a buildbot build, | 408 // sourcestamp extracts the source stamp from various parts of a buildbot build, |
| 407 // including the properties. | 409 // including the properties. |
| 408 func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp { | 410 func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp { |
| 409 ss := &resp.SourceStamp{} | 411 ss := &resp.SourceStamp{} |
| 410 rietveld := "" | 412 rietveld := "" |
| 411 gerrit := "" | 413 gerrit := "" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 698 |
| 697 if b.Master == "" { | 699 if b.Master == "" { |
| 698 return nil, errors.New("Master name is required", common.CodePar
ameterError) | 700 return nil, errors.New("Master name is required", common.CodePar
ameterError) |
| 699 } | 701 } |
| 700 if b.BuilderName == "" { | 702 if b.BuilderName == "" { |
| 701 return nil, errors.New("BuilderName name is required", common.Co
deParameterError) | 703 return nil, errors.New("BuilderName name is required", common.Co
deParameterError) |
| 702 } | 704 } |
| 703 | 705 |
| 704 return Build(c, b.Master, b.BuilderName, int(num)) | 706 return Build(c, b.Master, b.BuilderName, int(num)) |
| 705 } | 707 } |
| OLD | NEW |