| 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 those don't | 
 |  347     run the presubmit checks. | 
|  346   """ |  348   """ | 
|  347  |  349  | 
|  348   results = [] |  350   results = [] | 
|  349   atleast_one_docs_change = False |  351   atleast_one_docs_change = False | 
|  350   all_docs_changes = True |  352   all_docs_changes = True | 
|  351   for affected_file in change.AffectedFiles(): |  353   for affected_file in change.AffectedFiles(): | 
|  352     affected_file_path = affected_file.LocalPath() |  354     affected_file_path = affected_file.LocalPath() | 
|  353     file_path, _ = os.path.splitext(affected_file_path) |  355     file_path, _ = os.path.splitext(affected_file_path) | 
|  354     if 'site' == file_path.split(os.path.sep)[0]: |  356     if 'site' == file_path.split(os.path.sep)[0]: | 
|  355       atleast_one_docs_change = True |  357       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 ' |  400                 'Branch changes do not need to rely on the master branch\'s ' | 
|  399                 'tree status. Automatically added \'NOTREECHECKS=true\' to the ' |  401                 'tree status. Automatically added \'NOTREECHECKS=true\' to the ' | 
|  400                 'CL\'s description')) |  402                 'CL\'s description')) | 
|  401       if not re.search( |  403       if not re.search( | 
|  402           r'^NOTRY=true$', new_description, re.M | re.I): |  404           r'^NOTRY=true$', new_description, re.M | re.I): | 
|  403         new_description += "\nNOTRY=true" |  405         new_description += "\nNOTRY=true" | 
|  404         results.append( |  406         results.append( | 
|  405             output_api.PresubmitNotifyResult( |  407             output_api.PresubmitNotifyResult( | 
|  406                 'Trybots do not yet work for non-master branches. ' |  408                 'Trybots do not yet work for non-master branches. ' | 
|  407                 'Automatically added \'NOTRY=true\' to the CL\'s description')) |  409                 'Automatically added \'NOTRY=true\' to the CL\'s description')) | 
 |  410       if not re.search( | 
 |  411           r'^NOPRESUBMIT=true$', new_description, re.M | re.I): | 
 |  412         new_description += "\nNOPRESUBMIT=true" | 
 |  413         results.append( | 
 |  414             output_api.PresubmitNotifyResult( | 
 |  415                 'Branch changes do not run the presubmit checks.')) | 
|  408  |  416  | 
|  409     # Read and process the HASHTAGS file. |  417     # Read and process the HASHTAGS file. | 
|  410     hashtags_fullpath = os.path.join(change._local_root, 'HASHTAGS') |  418     hashtags_fullpath = os.path.join(change._local_root, 'HASHTAGS') | 
|  411     with open(hashtags_fullpath, 'rb') as hashtags_csv: |  419     with open(hashtags_fullpath, 'rb') as hashtags_csv: | 
|  412       hashtags_reader = csv.reader(hashtags_csv, delimiter=',') |  420       hashtags_reader = csv.reader(hashtags_csv, delimiter=',') | 
|  413       for row in hashtags_reader: |  421       for row in hashtags_reader: | 
|  414         if not row or row[0].startswith('#'): |  422         if not row or row[0].startswith('#'): | 
|  415           # Ignore empty lines and comments |  423           # Ignore empty lines and comments | 
|  416           continue |  424           continue | 
|  417         hashtag = row[0] |  425         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. |  485     state and an error if it is in 'Closed' state. | 
|  478   """ |  486   """ | 
|  479   results = [] |  487   results = [] | 
|  480   results.extend(_CommonChecks(input_api, output_api)) |  488   results.extend(_CommonChecks(input_api, output_api)) | 
|  481   results.extend( |  489   results.extend( | 
|  482       _CheckTreeStatus(input_api, output_api, json_url=( |  490       _CheckTreeStatus(input_api, output_api, json_url=( | 
|  483           SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |  491           SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 
|  484   results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |  492   results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 
|  485   results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) |  493   results.extend(_CheckOwnerIsInAuthorsFile(input_api, output_api)) | 
|  486   return results |  494   return results | 
| OLD | NEW |