OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 Chromium. | 5 """Top-level presubmit script for Chromium. |
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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 1944 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
1945 input_api, | 1945 input_api, |
1946 output_api, | 1946 output_api, |
1947 json_url='http://chromium-status.appspot.com/current?format=json')) | 1947 json_url='http://chromium-status.appspot.com/current?format=json')) |
1948 | 1948 |
1949 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 1949 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
1950 input_api, output_api)) | 1950 input_api, output_api)) |
1951 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1951 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
1952 input_api, output_api)) | 1952 input_api, output_api)) |
1953 return results | 1953 return results |
1954 | |
1955 | |
1956 def GetPreferredTryMasters(project, change): | |
1957 import json | |
1958 import os.path | |
1959 import platform | |
1960 import subprocess | |
1961 | |
1962 cq_config_path = os.path.join( | |
1963 change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') | |
1964 # commit_queue.py below is a script in depot_tools directory, which has a | |
1965 # 'builders' command to retrieve a list of CQ builders from the CQ config. | |
1966 is_win = platform.system() == 'Windows' | |
1967 masters = json.loads(subprocess.check_output( | |
1968 ['commit_queue', 'builders', cq_config_path], shell=is_win)) | |
1969 | |
1970 try_config = {} | |
1971 for master in masters: | |
1972 try_config.setdefault(master, {}) | |
1973 for builder in masters[master]: | |
1974 # Do not trigger presubmit builders, since they're likely to fail | |
1975 # (e.g. OWNERS checks before finished code review), and we're | |
1976 # running local presubmit anyway. | |
1977 if 'presubmit' not in builder: | |
1978 try_config[master][builder] = ['defaulttests'] | |
1979 | |
1980 return try_config | |
OLD | NEW |