Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 751ae525751be38445e4bca2fd0a02c0ac7dd03e..c3495e3887a3e70ae171ed3b270431903f684f9f 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -1784,29 +1784,26 @@ def CheckChangeOnCommit(input_api, output_api): |
| def GetPreferredTryMasters(project, change): |
| - import re |
| - files = change.LocalPaths() |
| - |
| - import os |
| import json |
| - with open(os.path.join( |
| - change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: |
| - cq_config = json.load(f) |
| - cq_verifiers = cq_config.get('verifiers_no_patch', {}) |
| - cq_try_jobs = cq_verifiers.get('try_job_verifier', {}) |
| - builders = cq_try_jobs.get('launched', {}) |
| - |
| - for master, master_config in cq_try_jobs.get('triggered', {}).iteritems(): |
| - for triggered_bot in master_config: |
| - builders.get(master, {}).pop(triggered_bot, None) |
| - |
| - # Explicitly iterate over copies of dicts since we mutate them. |
| - for master in builders.keys(): |
| - for builder in builders[master].keys(): |
| - # Do not trigger presubmit builders, since they're likely to fail |
| - # (e.g. OWNERS checks before finished code review), and we're |
| - # running local presubmit anyway. |
| - if 'presubmit' in builder: |
| - builders[master].pop(builder) |
| - |
| - return builders |
| + import os.path |
| + import subprocess |
| + |
| + cq_config_path = os.path.join( |
| + change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') |
| + masters = json.loads(subprocess.check_output( |
| + ['commit_queue.py', 'builders', cq_config_path])) |
|
pgervais
2015/05/29 17:05:51
The name 'commit_queue.py' is so confusing in this
Sergiy Byelozyorov
2015/05/29 17:08:23
I'll add a comment.
|
| + |
| + # Explicitly iterate over copies of dicts since we mutate them. |
|
pgervais
2015/05/29 17:05:50
'of dicts' -> 'of keys' ?
Sergiy Byelozyorov
2015/05/29 17:08:23
Done.
|
| + for master in masters.keys(): |
| + for builder in masters[master].keys(): |
| + # Do not trigger presubmit builders, since they're likely to fail |
| + # (e.g. OWNERS checks before finished code review), and we're |
| + # running local presubmit anyway. |
| + if 'presubmit' in builder: |
| + masters[master].pop(builder) |
| + else: |
| + # Convert testfilter format to the one expected by git-cl-try. |
| + testfilter = masters[master][builder].get('testfilter', 'defaulttests') |
| + masters[master][builder] = [testfilter] |
| + |
| + return masters |