| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Presubmit script for files in chrome/browser/resources. | 5 """Presubmit script for files in chrome/browser/resources. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 def CheckChangeOnUpload(input_api, output_api): | 108 def CheckChangeOnUpload(input_api, output_api): |
| 109 return _CheckChangeOnUploadOrCommit(input_api, output_api) | 109 return _CheckChangeOnUploadOrCommit(input_api, output_api) |
| 110 | 110 |
| 111 | 111 |
| 112 def CheckChangeOnCommit(input_api, output_api): | 112 def CheckChangeOnCommit(input_api, output_api): |
| 113 return _CheckChangeOnUploadOrCommit(input_api, output_api) | 113 return _CheckChangeOnUploadOrCommit(input_api, output_api) |
| 114 | 114 |
| 115 | 115 |
| 116 def PostUploadHook(cl, change, output_api): | 116 def PostUploadHook(cl, change, output_api): |
| 117 rietveld_obj = cl.RpcServer() | 117 return output_api.EnsureCQIncludeTrybotsAreAdded( |
| 118 description = rietveld_obj.get_description(cl.issue) | 118 cl, |
| 119 | 119 [ |
| 120 existing_bots = (change.CQ_INCLUDE_TRYBOTS or '').split(';') | 120 'master.tryserver.chromium.linux:closure_compilation', |
| 121 clean_bots = set(filter(None, map(lambda s: s.strip(), existing_bots))) | 121 ], |
| 122 new_bots = clean_bots | set( | 122 'Automatically added optional Closure bots to run on CQ.') |
| 123 ['master.tryserver.chromium.linux:closure_compilation']) | |
| 124 new_tag = 'CQ_INCLUDE_TRYBOTS=%s' % ';'.join(new_bots) | |
| 125 | |
| 126 if clean_bots: | |
| 127 tag_reg = '^CQ_INCLUDE_TRYBOTS=.*$' | |
| 128 new_description = re.sub(tag_reg, new_tag, description, flags=re.M | re.I) | |
| 129 else: | |
| 130 new_description = description + '\n' + new_tag | |
| 131 | |
| 132 if new_description == description: | |
| 133 return [] | |
| 134 | |
| 135 rietveld_obj.update_description(cl.issue, new_description) | |
| 136 return [output_api.PresubmitNotifyResult( | |
| 137 'Automatically added optional Closure bots to run on CQ.')] | |
| OLD | NEW |