Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 | 7 |
| 8 """ | 8 """ |
| 9 submit_try: Submit a try request. | 9 submit_try: Submit a try request. |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 ALL_BUILDERS = 'all' | 30 ALL_BUILDERS = 'all' |
| 31 # Alias which can be used to run a try on all compile builders. | 31 # Alias which can be used to run a try on all compile builders. |
| 32 COMPILE_BUILDERS = 'compile' | 32 COMPILE_BUILDERS = 'compile' |
| 33 # Alias which can be used to run a try on all builders that are run in the CQ. | 33 # Alias which can be used to run a try on all builders that are run in the CQ. |
| 34 CQ_BUILDERS = 'cq' | 34 CQ_BUILDERS = 'cq' |
| 35 # Alias which can be used to specify a regex to choose builders. | 35 # Alias which can be used to specify a regex to choose builders. |
| 36 REGEX = 'regex' | 36 REGEX = 'regex' |
| 37 | 37 |
| 38 ALL_ALIASES = [ALL_BUILDERS, COMPILE_BUILDERS, CQ_BUILDERS, REGEX] | 38 ALL_ALIASES = [ALL_BUILDERS, COMPILE_BUILDERS, CQ_BUILDERS, REGEX] |
| 39 | 39 |
| 40 GIT = 'git.bat' if os.name == 'nt' else 'git' | |
| 41 | |
| 40 # Contact information for the build master. | 42 # Contact information for the build master. |
| 41 SKIA_BUILD_MASTER_HOST = str(buildbot_globals.Get('public_master_host')) | 43 SKIA_BUILD_MASTER_HOST = str(buildbot_globals.Get('public_master_host')) |
| 42 SKIA_BUILD_MASTER_PORT = str(buildbot_globals.Get('public_external_port')) | 44 SKIA_BUILD_MASTER_PORT = str(buildbot_globals.Get('public_external_port')) |
| 43 | 45 |
| 44 # All try builders have this suffix. | 46 # All try builders have this suffix. |
| 45 TRYBOT_SUFFIX = '-Trybot' | 47 TRYBOT_SUFFIX = '-Trybot' |
| 46 | 48 |
| 47 # String for matching the svn url of the try server inside codereview.settings. | 49 # String for matching the svn url of the try server inside codereview.settings. |
| 48 TRYSERVER_SVN_URL = 'TRYSERVER_SVN_URL: ' | 50 TRYSERVER_SVN_URL = 'TRYSERVER_SVN_URL: ' |
| 49 | 51 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 if args.revision: | 262 if args.revision: |
| 261 try_args.extend(['-r', args.revision]) | 263 try_args.extend(['-r', args.revision]) |
| 262 print ' '.join(try_args) | 264 print ' '.join(try_args) |
| 263 proc = subprocess.Popen(try_args, stdout=subprocess.PIPE, | 265 proc = subprocess.Popen(try_args, stdout=subprocess.PIPE, |
| 264 stderr=subprocess.STDOUT) | 266 stderr=subprocess.STDOUT) |
| 265 if proc.wait() != 0: | 267 if proc.wait() != 0: |
| 266 raise Exception('Failed to submit try request: %s' % ( | 268 raise Exception('Failed to submit try request: %s' % ( |
| 267 proc.communicate()[0])) | 269 proc.communicate()[0])) |
| 268 print proc.communicate()[0] | 270 print proc.communicate()[0] |
| 269 else: | 271 else: |
| 270 # Create the diff file. | 272 # Find depot_tools. This is needed to import trychange. |
|
epoger
2014/01/13 20:44:53
This is needed to import git_cl and trychange.
borenet
2014/01/14 18:03:02
Done.
| |
| 271 cmd = ['git.bat' if os.name == 'nt' else 'git', 'diff', 'origin/master'] | 273 sys.path.append(FindDepotTools()) |
| 274 import git_cl | |
| 275 import trychange | |
| 276 | |
| 277 cmd = [GIT, 'diff', git_cl.Changelist().GetUpstreamBranch(), | |
| 278 '--no-ext-diff'] | |
| 272 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 279 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 273 if proc.wait() != 0: | 280 if proc.wait() != 0: |
| 274 raise Exception('Failed to capture git diff!') | 281 raise Exception('Failed to capture git diff!') |
| 275 | 282 |
| 276 temp_dir = tempfile.mkdtemp() | 283 temp_dir = tempfile.mkdtemp() |
| 277 try: | 284 try: |
| 278 diff_file = os.path.join(temp_dir, 'patch.diff') | 285 diff_file = os.path.join(temp_dir, 'patch.diff') |
| 279 with open(diff_file, 'wb') as f: | 286 with open(diff_file, 'wb') as f: |
| 280 f.write(proc.communicate()[0]) | 287 f.write(proc.communicate()[0]) |
| 281 | 288 |
| 282 # Find depot_tools. This is needed to import trychange. | |
| 283 sys.path.append(FindDepotTools()) | |
| 284 import trychange | |
| 285 try_args = ['--use_svn', | 289 try_args = ['--use_svn', |
| 286 '--svn_repo', GetTryRepo(), | 290 '--svn_repo', GetTryRepo(), |
| 287 '--root', GetCheckoutRoot(is_svn), | 291 '--root', GetCheckoutRoot(is_svn), |
| 288 '--bot', botlist, | 292 '--bot', botlist, |
| 289 '--diff', diff_file, | 293 '--diff', diff_file, |
| 290 ] | 294 ] |
| 291 if args.revision: | 295 if args.revision: |
| 292 try_args.extend(['-r', args.revision]) | 296 try_args.extend(['-r', args.revision]) |
| 293 | 297 |
| 294 # Submit the try request. | 298 # Submit the try request. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 306 | 310 |
| 307 # Parse and validate the command-line arguments. | 311 # Parse and validate the command-line arguments. |
| 308 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) | 312 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) |
| 309 | 313 |
| 310 # Submit the try request. | 314 # Submit the try request. |
| 311 SubmitTryRequest(args, is_svn=is_svn) | 315 SubmitTryRequest(args, is_svn=is_svn) |
| 312 | 316 |
| 313 | 317 |
| 314 if __name__ == '__main__': | 318 if __name__ == '__main__': |
| 315 sys.exit(main()) | 319 sys.exit(main()) |
| OLD | NEW |