| 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 """Top-level presubmit script for Blink. | 5 """Top-level presubmit script for Blink. |
| 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 gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 def CheckChangeOnCommit(input_api, output_api): | 314 def CheckChangeOnCommit(input_api, output_api): |
| 315 results = [] | 315 results = [] |
| 316 results.extend(_CommonChecks(input_api, output_api)) | 316 results.extend(_CommonChecks(input_api, output_api)) |
| 317 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 317 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 318 input_api, output_api, | 318 input_api, output_api, |
| 319 json_url='http://chromium-status.appspot.com/current?format=json')) | 319 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 320 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 320 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 321 input_api, output_api)) | 321 input_api, output_api)) |
| 322 return results | 322 return results |
| 323 | |
| 324 | |
| 325 def GetPreferredTryMasters(project, change): | |
| 326 import json | |
| 327 import os.path | |
| 328 import platform | |
| 329 import subprocess | |
| 330 | |
| 331 cq_config_path = os.path.join( | |
| 332 change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') | |
| 333 # commit_queue.py below is a script in depot_tools directory, which has a | |
| 334 # 'builders' command to retrieve a list of CQ builders from the CQ config. | |
| 335 is_win = platform.system() == 'Windows' | |
| 336 masters = json.loads(subprocess.check_output( | |
| 337 ['commit_queue', 'builders', cq_config_path], shell=is_win)) | |
| 338 | |
| 339 try_config = {} | |
| 340 for master in masters: | |
| 341 try_config.setdefault(master, {}) | |
| 342 for builder in masters[master]: | |
| 343 # Do not trigger presubmit builders, since they're likely to fail | |
| 344 # (e.g. OWNERS checks before finished code review), and we're | |
| 345 # running local presubmit anyway. | |
| 346 if 'presubmit' not in builder: | |
| 347 try_config[master][builder] = ['defaulttests'] | |
| 348 | |
| 349 return try_config | |
| OLD | NEW |