| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Repo defines a git repository. | 29 // Repo defines a git repository. |
| 30 type Repo struct { | 30 type Repo struct { |
| 31 // Server is the full path to a git repository. Server must start with
https:// | 31 // Server is the full path to a git repository. Server must start with
https:// |
| 32 // and should not end with .git. | 32 // and should not end with .git. |
| 33 Server string | 33 Server string |
| 34 // Branch specifies a treeish of a git repository. This is generally a
branch. | 34 // Branch specifies a treeish of a git repository. This is generally a
branch. |
| 35 Branch string | 35 Branch string |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Author is the author returned from a gitiles log request. | 38 // User is the author or the committer returned from a gitiles log request. |
| 39 type Author struct { | 39 type User struct { |
| 40 Name string `json:"name"` | 40 Name string `json:"name"` |
| 41 Email string `json:"email"` | 41 Email string `json:"email"` |
| 42 Time string `json:"time"` | 42 Time string `json:"time"` |
| 43 } | |
| 44 | |
| 45 // Committer is the committer information returned from a gitiles log request. | |
| 46 type Committer struct { | |
| 47 Name string `json:"name"` | |
| 48 Email string `json:"email"` | |
| 49 Time string `json:"time"` | |
| 50 } | 43 } |
| 51 | 44 |
| 52 // Log is the Log information of a commit returned from a gitiles log request. | 45 // Log is the Log information of a commit returned from a gitiles log request. |
| 53 type Log struct { | 46 type Log struct { |
| 54 » Commit string `json:"commit"` | 47 » Commit string `json:"commit"` |
| 55 » Tree string `json:"tree"` | 48 » Tree string `json:"tree"` |
| 56 » Parents []string `json:"parents"` | 49 » Parents []string `json:"parents"` |
| 57 » Author Author `json:"author"` | 50 » Author User `json:"author"` |
| 58 » Committer Committer `json:"committer"` | 51 » Committer User `json:"committer"` |
| 59 » Message string `json:"message"` | 52 » Message string `json:"message"` |
| 60 } | 53 } |
| 61 | 54 |
| 62 // Commit is the JSON response from querying gitiles for a log request. | 55 // Commit is the JSON response from querying gitiles for a log request. |
| 63 type Commit struct { | 56 type Commit struct { |
| 64 Log []Log `json:"log"` | 57 Log []Log `json:"log"` |
| 65 Next string `json:"next"` | 58 Next string `json:"next"` |
| 66 } | 59 } |
| 67 | 60 |
| 68 // fixURL validates and normalizes a repoURL and treeish, and returns the | 61 // fixURL validates and normalizes a repoURL and treeish, and returns the |
| 69 // log JSON gitiles URL. | 62 // log JSON gitiles URL. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 Repo: repoURL, | 118 Repo: repoURL, |
| 126 Revision: resp.NewLink(log.Commit, repoURL+"/+/"+log.
Commit), | 119 Revision: resp.NewLink(log.Commit, repoURL+"/+/"+log.
Commit), |
| 127 Description: log.Message, | 120 Description: log.Message, |
| 128 Title: strings.SplitN(log.Message, "\n", 2)[0], | 121 Title: strings.SplitN(log.Message, "\n", 2)[0], |
| 129 // TODO(hinoka): Fill in the rest of resp.Commit and add
those details | 122 // TODO(hinoka): Fill in the rest of resp.Commit and add
those details |
| 130 // in the html. | 123 // in the html. |
| 131 } | 124 } |
| 132 } | 125 } |
| 133 return result, nil | 126 return result, nil |
| 134 } | 127 } |
| OLD | NEW |