| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Top-level presubmit script for Skia. | 6 """Top-level presubmit script for Skia. |
| 7 | 7 |
| 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
| 10 """ | 10 """ |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 | 137 |
| 138 def CheckChangeOnUpload(input_api, output_api): | 138 def CheckChangeOnUpload(input_api, output_api): |
| 139 """Presubmit checks for the change on upload. | 139 """Presubmit checks for the change on upload. |
| 140 | 140 |
| 141 The following are the presubmit checks: | 141 The following are the presubmit checks: |
| 142 * Check change has one and only one EOL. | 142 * Check change has one and only one EOL. |
| 143 """ | 143 """ |
| 144 results = [] | 144 results = [] |
| 145 results.extend(_CommonChecks(input_api, output_api)) | 145 results.extend(_CommonChecks(input_api, output_api)) |
| 146 # TODO(rmistry): Remove the below it is only for testing!!! | |
| 147 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | |
| 148 return results | 146 return results |
| 149 | 147 |
| 150 | 148 |
| 151 def _CheckTreeStatus(input_api, output_api, json_url): | 149 def _CheckTreeStatus(input_api, output_api, json_url): |
| 152 """Check whether to allow commit. | 150 """Check whether to allow commit. |
| 153 | 151 |
| 154 Args: | 152 Args: |
| 155 input_api: input related apis. | 153 input_api: input related apis. |
| 156 output_api: output related apis. | 154 output_api: output related apis. |
| 157 json_url: url to download json style status. | 155 json_url: url to download json style status. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 247 |
| 250 lgtm_from_owner = False | 248 lgtm_from_owner = False |
| 251 issue = input_api.change.issue | 249 issue = input_api.change.issue |
| 252 if issue and input_api.rietveld: | 250 if issue and input_api.rietveld: |
| 253 issue_properties = input_api.rietveld.get_issue_properties( | 251 issue_properties = input_api.rietveld.get_issue_properties( |
| 254 issue=int(issue), messages=True) | 252 issue=int(issue), messages=True) |
| 255 if re.match(REVERT_CL_SUBJECT_PREFIX, issue_properties['subject'], re.I): | 253 if re.match(REVERT_CL_SUBJECT_PREFIX, issue_properties['subject'], re.I): |
| 256 # It is a revert CL, ignore the public api owners check. | 254 # It is a revert CL, ignore the public api owners check. |
| 257 return results | 255 return results |
| 258 | 256 |
| 259 if re.search(r'^COMMIT=false$', issue_properties['description'], re.M): | |
| 260 # Ignore public api owners check for COMMIT=false CLs since they are not | |
| 261 # going to be committed. | |
| 262 return results | |
| 263 | |
| 264 match = re.search(r'^TBR=(.*)$', issue_properties['description'], re.M) | 257 match = re.search(r'^TBR=(.*)$', issue_properties['description'], re.M) |
| 265 if match: | 258 if match: |
| 266 tbr_entries = match.group(1).strip().split(',') | 259 tbr_entries = match.group(1).strip().split(',') |
| 267 for owner in PUBLIC_API_OWNERS: | 260 for owner in PUBLIC_API_OWNERS: |
| 268 if owner in tbr_entries or owner.split('@')[0] in tbr_entries: | 261 if owner in tbr_entries or owner.split('@')[0] in tbr_entries: |
| 269 # If an owner is specified in the TBR= line then ignore the public | 262 # If an owner is specified in the TBR= line then ignore the public |
| 270 # api owners check. | 263 # api owners check. |
| 271 return results | 264 return results |
| 272 | 265 |
| 273 if issue_properties['owner_email'] in PUBLIC_API_OWNERS: | 266 if issue_properties['owner_email'] in PUBLIC_API_OWNERS: |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 state and an error if it is in 'Closed' state. | 375 state and an error if it is in 'Closed' state. |
| 383 """ | 376 """ |
| 384 results = [] | 377 results = [] |
| 385 results.extend(_CommonChecks(input_api, output_api)) | 378 results.extend(_CommonChecks(input_api, output_api)) |
| 386 results.extend( | 379 results.extend( |
| 387 _CheckTreeStatus(input_api, output_api, json_url=( | 380 _CheckTreeStatus(input_api, output_api, json_url=( |
| 388 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 381 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 389 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 382 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 390 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 383 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
| 391 return results | 384 return results |
| OLD | NEW |