| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 7 | 7 |
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
| 9 | 9 |
| 10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 name, while the developers always use shortened master name | 215 name, while the developers always use shortened master name |
| 216 (tryserver.chromium.linux) by stripping off the prefix 'master.'. This | 216 (tryserver.chromium.linux) by stripping off the prefix 'master.'. This |
| 217 function does the conversion for buildbucket migration. | 217 function does the conversion for buildbucket migration. |
| 218 """ | 218 """ |
| 219 prefix = 'master.' | 219 prefix = 'master.' |
| 220 if master.startswith(prefix): | 220 if master.startswith(prefix): |
| 221 return master | 221 return master |
| 222 return '%s%s' % (prefix, master) | 222 return '%s%s' % (prefix, master) |
| 223 | 223 |
| 224 | 224 |
| 225 def trigger_try_jobs(auth_config, changelist, options, masters, category): | 225 def trigger_try_jobs(auth_config, changelist, options, masters, category, |
| 226 override_properties=None): |
| 226 rietveld_url = settings.GetDefaultServerUrl() | 227 rietveld_url = settings.GetDefaultServerUrl() |
| 227 rietveld_host = urlparse.urlparse(rietveld_url).hostname | 228 rietveld_host = urlparse.urlparse(rietveld_url).hostname |
| 228 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) | 229 authenticator = auth.get_authenticator_for_host(rietveld_host, auth_config) |
| 229 http = authenticator.authorize(httplib2.Http()) | 230 http = authenticator.authorize(httplib2.Http()) |
| 230 http.force_exception_to_status_code = True | 231 http.force_exception_to_status_code = True |
| 231 issue_props = changelist.GetIssueProperties() | 232 issue_props = changelist.GetIssueProperties() |
| 232 issue = changelist.GetIssue() | 233 issue = changelist.GetIssue() |
| 233 patchset = changelist.GetMostRecentPatchset() | 234 patchset = changelist.GetMostRecentPatchset() |
| 234 | 235 |
| 235 buildbucket_put_url = ( | 236 buildbucket_put_url = ( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 259 'master': master, | 260 'master': master, |
| 260 'patch_project': issue_props['project'], | 261 'patch_project': issue_props['project'], |
| 261 'patch_storage': 'rietveld', | 262 'patch_storage': 'rietveld', |
| 262 'patchset': patchset, | 263 'patchset': patchset, |
| 263 'reason': options.name, | 264 'reason': options.name, |
| 264 'revision': options.revision, | 265 'revision': options.revision, |
| 265 'rietveld': rietveld_url, | 266 'rietveld': rietveld_url, |
| 266 'testfilter': tests, | 267 'testfilter': tests, |
| 267 }, | 268 }, |
| 268 } | 269 } |
| 270 if override_properties: |
| 271 parameters['properties'].update(override_properties) |
| 269 if options.clobber: | 272 if options.clobber: |
| 270 parameters['properties']['clobber'] = True | 273 parameters['properties']['clobber'] = True |
| 271 batch_req_body['builds'].append( | 274 batch_req_body['builds'].append( |
| 272 { | 275 { |
| 273 'bucket': bucket, | 276 'bucket': bucket, |
| 274 'parameters_json': json.dumps(parameters), | 277 'parameters_json': json.dumps(parameters), |
| 275 'tags': ['builder:%s' % builder, | 278 'tags': ['builder:%s' % builder, |
| 276 'buildset:%s' % buildset, | 279 'buildset:%s' % buildset, |
| 277 'master:%s' % master, | 280 'master:%s' % master, |
| 278 'user_agent:git_cl_try'] | 281 'user_agent:git_cl_try'] |
| (...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3339 if __name__ == '__main__': | 3342 if __name__ == '__main__': |
| 3340 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3343 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 3341 # unit testing. | 3344 # unit testing. |
| 3342 fix_encoding.fix_encoding() | 3345 fix_encoding.fix_encoding() |
| 3343 colorama.init() | 3346 colorama.init() |
| 3344 try: | 3347 try: |
| 3345 sys.exit(main(sys.argv[1:])) | 3348 sys.exit(main(sys.argv[1:])) |
| 3346 except KeyboardInterrupt: | 3349 except KeyboardInterrupt: |
| 3347 sys.stderr.write('interrupted\n') | 3350 sys.stderr.write('interrupted\n') |
| 3348 sys.exit(1) | 3351 sys.exit(1) |
| OLD | NEW |