| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 print proc.communicate()[0] | 279 print proc.communicate()[0] |
| 280 else: | 280 else: |
| 281 # Find depot_tools. This is needed to import git_cl and trychange. | 281 # Find depot_tools. This is needed to import git_cl and trychange. |
| 282 sys.path.append(FindDepotTools()) | 282 sys.path.append(FindDepotTools()) |
| 283 import git_cl | 283 import git_cl |
| 284 import trychange | 284 import trychange |
| 285 | 285 |
| 286 cmd = [GIT, 'diff', git_cl.Changelist().GetUpstreamBranch(), | 286 cmd = [GIT, 'diff', git_cl.Changelist().GetUpstreamBranch(), |
| 287 '--no-ext-diff'] | 287 '--no-ext-diff'] |
| 288 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 288 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 289 if proc.wait() != 0: | 289 git_data = proc.communicate() |
| 290 if git_data[0] is None: |
| 290 raise Exception('Failed to capture git diff!') | 291 raise Exception('Failed to capture git diff!') |
| 291 | 292 |
| 292 temp_dir = tempfile.mkdtemp() | 293 temp_dir = tempfile.mkdtemp() |
| 293 try: | 294 try: |
| 294 diff_file = os.path.join(temp_dir, 'patch.diff') | 295 diff_file = os.path.join(temp_dir, 'patch.diff') |
| 295 with open(diff_file, 'wb') as f: | 296 with open(diff_file, 'wb') as f: |
| 296 f.write(proc.communicate()[0]) | 297 f.write(git_data[0]) |
| 297 | 298 f.close() |
| 299 |
| 298 try_args = ['--use_svn', | 300 try_args = ['--use_svn', |
| 299 '--svn_repo', GetTryRepo(), | 301 '--svn_repo', GetTryRepo(), |
| 300 '--root', GetCheckoutRoot(is_svn), | 302 '--root', GetCheckoutRoot(is_svn), |
| 301 '--bot', botlist, | 303 '--bot', botlist, |
| 302 '--diff', diff_file, | 304 '--diff', diff_file, |
| 303 ] | 305 ] |
| 304 if args.revision: | 306 if args.revision: |
| 305 try_args.extend(['-r', args.revision]) | 307 try_args.extend(['-r', args.revision]) |
| 306 | 308 |
| 307 # Submit the try request. | 309 # Submit the try request. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 320 # Parse and validate the command-line arguments. | 322 # Parse and validate the command-line arguments. |
| 321 args = ValidateArgs(sys.argv[1:], trybots=trybots, cq_trybots=cq_trybots, | 323 args = ValidateArgs(sys.argv[1:], trybots=trybots, cq_trybots=cq_trybots, |
| 322 is_svn=is_svn) | 324 is_svn=is_svn) |
| 323 | 325 |
| 324 # Submit the try request. | 326 # Submit the try request. |
| 325 SubmitTryRequest(args, is_svn=is_svn) | 327 SubmitTryRequest(args, is_svn=is_svn) |
| 326 | 328 |
| 327 | 329 |
| 328 if __name__ == '__main__': | 330 if __name__ == '__main__': |
| 329 sys.exit(main()) | 331 sys.exit(main()) |
| OLD | NEW |