| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 | 57 |
| 58 def CheckChangeOnUpload(input_api, output_api): | 58 def CheckChangeOnUpload(input_api, output_api): |
| 59 """Presubmit checks for the change on upload. | 59 """Presubmit checks for the change on upload. |
| 60 | 60 |
| 61 The following are the presubmit checks: | 61 The following are the presubmit checks: |
| 62 * Check change has one and only one EOL. | 62 * Check change has one and only one EOL. |
| 63 """ | 63 """ |
| 64 results = [] | 64 results = [] |
| 65 results.extend(_CommonChecks(input_api, output_api)) | 65 results.extend(_CommonChecks(input_api, output_api)) |
| 66 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 66 return results | 67 return results |
| 67 | 68 |
| 68 | 69 |
| 69 def _CheckTreeStatus(input_api, output_api, json_url): | 70 def _CheckTreeStatus(input_api, output_api, json_url): |
| 70 """Check whether to allow commit. | 71 """Check whether to allow commit. |
| 71 | 72 |
| 72 Args: | 73 Args: |
| 73 input_api: input related apis. | 74 input_api: input related apis. |
| 74 output_api: output related apis. | 75 output_api: output related apis. |
| 75 json_url: url to download json style status. | 76 json_url: url to download json style status. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 requires_owner_check = True | 121 requires_owner_check = True |
| 121 | 122 |
| 122 if not requires_owner_check: | 123 if not requires_owner_check: |
| 123 return results | 124 return results |
| 124 | 125 |
| 125 lgtm_from_owner = False | 126 lgtm_from_owner = False |
| 126 issue = input_api.change.issue | 127 issue = input_api.change.issue |
| 127 if issue and input_api.rietveld: | 128 if issue and input_api.rietveld: |
| 128 issue_properties = input_api.rietveld.get_issue_properties( | 129 issue_properties = input_api.rietveld.get_issue_properties( |
| 129 issue=int(issue), messages=True) | 130 issue=int(issue), messages=True) |
| 131 # TODO(rmistry): Check the description here and determine if it is a |
| 132 # one-click revert CL. Just look at the subject actually and then determine
this! |
| 133 print 'HERE HERE' |
| 134 print issue_properties['subject'] |
| 135 print 'HERE HERE' |
| 130 if issue_properties['owner_email'] in PUBLIC_API_OWNERS: | 136 if issue_properties['owner_email'] in PUBLIC_API_OWNERS: |
| 131 # An owner created the CL that is an automatic LGTM. | 137 # An owner created the CL that is an automatic LGTM. |
| 132 lgtm_from_owner = True | 138 lgtm_from_owner = True |
| 133 | 139 |
| 134 messages = issue_properties.get('messages') | 140 messages = issue_properties.get('messages') |
| 135 if messages: | 141 if messages: |
| 136 for message in messages: | 142 for message in messages: |
| 137 if (message['sender'] in PUBLIC_API_OWNERS and | 143 if (message['sender'] in PUBLIC_API_OWNERS and |
| 138 'lgtm' in message['text'].lower()): | 144 'lgtm' in message['text'].lower()): |
| 139 # Found an lgtm in a message from an owner. | 145 # Found an lgtm in a message from an owner. |
| 140 lgtm_from_owner = True | 146 lgtm_from_owner = True |
| 141 break; | 147 break; |
| 148 else: |
| 149 print 'NO ISSUE AVAILABLE!!!!!!!!!!!!!!!!!!!!!' |
| 142 | 150 |
| 143 if not lgtm_from_owner: | 151 if not lgtm_from_owner: |
| 144 results.append( | 152 results.append( |
| 145 output_api.PresubmitError( | 153 output_api.PresubmitError( |
| 146 'Since the CL is editing public API, you must have an LGTM from ' | 154 'Since the CL is editing public API, you must have an LGTM from ' |
| 147 'one of: %s' % str(PUBLIC_API_OWNERS))) | 155 'one of: %s' % str(PUBLIC_API_OWNERS))) |
| 148 return results | 156 return results |
| 149 | 157 |
| 150 | 158 |
| 151 def CheckChangeOnCommit(input_api, output_api): | 159 def CheckChangeOnCommit(input_api, output_api): |
| 152 """Presubmit checks for the change on commit. | 160 """Presubmit checks for the change on commit. |
| 153 | 161 |
| 154 The following are the presubmit checks: | 162 The following are the presubmit checks: |
| 155 * Check change has one and only one EOL. | 163 * Check change has one and only one EOL. |
| 156 * Ensures that the Skia tree is open in | 164 * Ensures that the Skia tree is open in |
| 157 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' | 165 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' |
| 158 state and an error if it is in 'Closed' state. | 166 state and an error if it is in 'Closed' state. |
| 159 """ | 167 """ |
| 160 results = [] | 168 results = [] |
| 161 results.extend(_CommonChecks(input_api, output_api)) | 169 results.extend(_CommonChecks(input_api, output_api)) |
| 162 results.extend( | 170 results.extend( |
| 163 _CheckTreeStatus(input_api, output_api, json_url=( | 171 _CheckTreeStatus(input_api, output_api, json_url=( |
| 164 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 172 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 165 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 173 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 166 return results | 174 return results |
| OLD | NEW |