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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 def PostUploadHook(cl, change, output_api): | 336 def PostUploadHook(cl, change, output_api): |
337 """git cl upload will call this hook after the issue is created/modified. | 337 """git cl upload will call this hook after the issue is created/modified. |
338 | 338 |
339 This hook does the following: | 339 This hook does the following: |
340 * Adds a link to preview docs changes if there are any docs changes in the CL. | 340 * Adds a link to preview docs changes if there are any docs changes in the CL. |
341 * Adds 'NOTRY=true' if the CL contains only docs changes. | 341 * Adds 'NOTRY=true' if the CL contains only docs changes. |
342 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not | 342 * Adds 'NOTREECHECKS=true' for non master branch changes since they do not |
343 need to be gated on the master branch's tree. | 343 need to be gated on the master branch's tree. |
344 * Adds 'NOTRY=true' for non master branch changes since trybots do not yet | 344 * Adds 'NOTRY=true' for non master branch changes since trybots do not yet |
345 work on them. | 345 work on them. |
346 * Adds 'NOPRESUBMIT=true' for non master branch changes since | |
rmistry
2015/06/04 17:18:29
missing the rest of this sentence
borenet
2015/06/04 17:26:57
Yeah... why don't we run presubmit for changes on
rmistry
2015/06/04 17:28:53
Because presubmit is now a trybot and trybots dont
| |
346 """ | 347 """ |
347 | 348 |
348 results = [] | 349 results = [] |
349 atleast_one_docs_change = False | 350 atleast_one_docs_change = False |
350 all_docs_changes = True | 351 all_docs_changes = True |
351 for affected_file in change.AffectedFiles(): | 352 for affected_file in change.AffectedFiles(): |
352 affected_file_path = affected_file.LocalPath() | 353 affected_file_path = affected_file.LocalPath() |
353 file_path, _ = os.path.splitext(affected_file_path) | 354 file_path, _ = os.path.splitext(affected_file_path) |
354 if 'site' == file_path.split(os.path.sep)[0]: | 355 if 'site' == file_path.split(os.path.sep)[0]: |
355 atleast_one_docs_change = True | 356 atleast_one_docs_change = True |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 'Branch changes do not need to rely on the master branch\'s ' | 399 'Branch changes do not need to rely on the master branch\'s ' |
399 'tree status. Automatically added \'NOTREECHECKS=true\' to the ' | 400 'tree status. Automatically added \'NOTREECHECKS=true\' to the ' |
400 'CL\'s description')) | 401 'CL\'s description')) |
401 if not re.search( | 402 if not re.search( |
402 r'^NOTRY=true$', new_description, re.M | re.I): | 403 r'^NOTRY=true$', new_description, re.M | re.I): |
403 new_description += "\nNOTRY=true" | 404 new_description += "\nNOTRY=true" |
404 results.append( | 405 results.append( |
405 output_api.PresubmitNotifyResult( | 406 output_api.PresubmitNotifyResult( |
406 'Trybots do not yet work for non-master branches. ' | 407 'Trybots do not yet work for non-master branches. ' |
407 'Automatically added \'NOTRY=true\' to the CL\'s description')) | 408 'Automatically added \'NOTRY=true\' to the CL\'s description')) |
409 if not re.search( | |
410 r'^NOPRESUBMIT=true$', new_description, re.M | re.I): | |
411 new_description += "\nNOTREECHECKS=true" | |
rmistry
2015/06/04 17:18:29
NOTREECHECKS -> NOPRESUBMIT
borenet
2015/06/04 17:26:57
Whoops, did this too quickly.
| |
412 results.append( | |
413 output_api.PresubmitNotifyResult( | |
414 'Branch changes do not run the presubmit checks.')) | |
408 | 415 |
409 # Read and process the HASHTAGS file. | 416 # Read and process the HASHTAGS file. |
410 hashtags_fullpath = os.path.join(change._local_root, 'HASHTAGS') | 417 hashtags_fullpath = os.path.join(change._local_root, 'HASHTAGS') |
411 with open(hashtags_fullpath, 'rb') as hashtags_csv: | 418 with open(hashtags_fullpath, 'rb') as hashtags_csv: |
412 hashtags_reader = csv.reader(hashtags_csv, delimiter=',') | 419 hashtags_reader = csv.reader(hashtags_csv, delimiter=',') |
413 for row in hashtags_reader: | 420 for row in hashtags_reader: |
414 if not row or row[0].startswith('#'): | 421 if not row or row[0].startswith('#'): |
415 # Ignore empty lines and comments | 422 # Ignore empty lines and comments |
416 continue | 423 continue |
417 hashtag = row[0] | 424 hashtag = row[0] |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 state and an error if it is in 'Closed' state. | 484 state and an error if it is in 'Closed' state. |
478 """ | 485 """ |
479 results = [] | 486 results = [] |
480 results.extend(_CommonChecks(input_api, output_api)) | 487 results.extend(_CommonChecks(input_api, output_api)) |
481 results.extend( | 488 results.extend( |
482 _CheckTreeStatus(input_api, output_api, json_url=( | 489 _CheckTreeStatus(input_api, output_api, json_url=( |
483 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 490 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
484 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 491 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
485 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 492 results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |
486 return results | 493 return results |
OLD | NEW |