Chromium Code Reviews| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 'one of: %s' % str(PUBLIC_API_OWNERS))) | 241 'one of: %s' % str(PUBLIC_API_OWNERS))) |
| 242 return results | 242 return results |
| 243 | 243 |
| 244 | 244 |
| 245 def PostUploadHook(cl, change, output_api): | 245 def PostUploadHook(cl, change, output_api): |
| 246 """git cl upload will call this hook after the issue is created/modified. | 246 """git cl upload will call this hook after the issue is created/modified. |
| 247 | 247 |
| 248 This hook does the following: | 248 This hook does the following: |
| 249 * Adds a link to preview docs changes if there are any docs changes in the CL. | 249 * Adds a link to preview docs changes if there are any docs changes in the CL. |
| 250 * Adds 'NOTRY=true' if the CL contains only docs changes. | 250 * Adds 'NOTRY=true' if the CL contains only docs changes. |
| 251 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not | |
| 252 need to be gated on the master branch's tree. | |
| 251 """ | 253 """ |
| 252 | 254 |
| 253 results = [] | 255 results = [] |
| 254 atleast_one_docs_change = False | 256 atleast_one_docs_change = False |
| 255 all_docs_changes = True | 257 all_docs_changes = True |
| 256 for affected_file in change.AffectedFiles(): | 258 for affected_file in change.AffectedFiles(): |
| 257 affected_file_path = affected_file.LocalPath() | 259 affected_file_path = affected_file.LocalPath() |
| 258 file_path, _ = os.path.splitext(affected_file_path) | 260 file_path, _ = os.path.splitext(affected_file_path) |
| 259 if 'site' == file_path.split(os.path.sep)[0]: | 261 if 'site' == file_path.split(os.path.sep)[0]: |
| 260 atleast_one_docs_change = True | 262 atleast_one_docs_change = True |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 283 # description if it does not already exist there. | 285 # description if it does not already exist there. |
| 284 if atleast_one_docs_change and not re.search( | 286 if atleast_one_docs_change and not re.search( |
| 285 r'^DOCS_PREVIEW=.*', original_description, re.M | re.I): | 287 r'^DOCS_PREVIEW=.*', original_description, re.M | re.I): |
| 286 # Automatically add a link to where the docs can be previewed. | 288 # Automatically add a link to where the docs can be previewed. |
| 287 new_description += '\nDOCS_PREVIEW= %s%s' % (DOCS_PREVIEW_URL, issue) | 289 new_description += '\nDOCS_PREVIEW= %s%s' % (DOCS_PREVIEW_URL, issue) |
| 288 results.append( | 290 results.append( |
| 289 output_api.PresubmitNotifyResult( | 291 output_api.PresubmitNotifyResult( |
| 290 'Automatically added a link to preview the docs changes to the ' | 292 'Automatically added a link to preview the docs changes to the ' |
| 291 'CL\'s description')) | 293 'CL\'s description')) |
| 292 | 294 |
| 295 # If the target ref is not master then add NOTREECHECKS=true to the CL's | |
| 296 # description if it does not already exist there. | |
| 297 target_ref = rietveld_obj.get_issue_properties(issue, False).get( | |
| 298 'target_ref', '') | |
| 299 if target_ref != 'refs/heads/master' and not re.search( | |
| 300 r'^NOTREECHECKS=true$', original_description, re.M | re.I): | |
| 301 new_description += "\nNOTREECHECKS=true" | |
|
borenet
2015/02/26 18:41:43
For the moment, should we also add NOTRY=true sinc
| |
| 302 results.append( | |
| 303 output_api.PresubmitNotifyResult( | |
| 304 'Branch changes do not need to rely on the master branch\'s tree ' | |
| 305 'status. Automatically added \'NOTREECHECKS=true\' to the CL\'s ' | |
| 306 'description')) | |
| 307 | |
| 293 # If the description has changed update it. | 308 # If the description has changed update it. |
| 294 if new_description != original_description: | 309 if new_description != original_description: |
| 295 rietveld_obj.update_description(issue, new_description) | 310 rietveld_obj.update_description(issue, new_description) |
| 296 | 311 |
| 297 return results | 312 return results |
| 298 | 313 |
| 299 | 314 |
| 300 def CheckChangeOnCommit(input_api, output_api): | 315 def CheckChangeOnCommit(input_api, output_api): |
| 301 """Presubmit checks for the change on commit. | 316 """Presubmit checks for the change on commit. |
| 302 | 317 |
| 303 The following are the presubmit checks: | 318 The following are the presubmit checks: |
| 304 * Check change has one and only one EOL. | 319 * Check change has one and only one EOL. |
| 305 * Ensures that the Skia tree is open in | 320 * Ensures that the Skia tree is open in |
| 306 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' | 321 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' |
| 307 state and an error if it is in 'Closed' state. | 322 state and an error if it is in 'Closed' state. |
| 308 """ | 323 """ |
| 309 results = [] | 324 results = [] |
| 310 results.extend(_CommonChecks(input_api, output_api)) | 325 results.extend(_CommonChecks(input_api, output_api)) |
| 311 results.extend( | 326 results.extend( |
| 312 _CheckTreeStatus(input_api, output_api, json_url=( | 327 _CheckTreeStatus(input_api, output_api, json_url=( |
| 313 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 328 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 314 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 329 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 315 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 330 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
| 316 return results | 331 return results |
| OLD | NEW |