| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 """Client-side script to send a try job to the try server. It communicates to | 5 """Client-side script to send a try job to the try server. It communicates to |
| 6 the try server by either writting to a svn repository or by directly connecting | 6 the try server by either writting to a svn repository or by directly connecting |
| 7 to the server by HTTP. | 7 to the server by HTTP. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 | 10 |
| 11 import datetime | 11 import datetime |
| 12 import getpass | 12 import getpass |
| 13 import logging | 13 import logging |
| 14 import optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import shutil | 16 import shutil |
| 17 import socket | 17 import socket |
| 18 import subprocess |
| 18 import sys | 19 import sys |
| 19 import tempfile | 20 import tempfile |
| 20 import traceback | 21 import traceback |
| 21 import urllib | 22 import urllib |
| 22 | 23 |
| 23 import gcl | 24 import gcl |
| 24 import gclient | 25 import gclient |
| 25 import gclient_scm | 26 import gclient_scm |
| 26 import upload | 27 import upload |
| 27 | 28 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 for (k,v) in values.iteritems(): | 311 for (k,v) in values.iteritems(): |
| 311 description += "%s=%s\n" % (k,v) | 312 description += "%s=%s\n" % (k,v) |
| 312 | 313 |
| 313 # Do an empty checkout. | 314 # Do an empty checkout. |
| 314 temp_dir = tempfile.mkdtemp() | 315 temp_dir = tempfile.mkdtemp() |
| 315 temp_file = tempfile.NamedTemporaryFile() | 316 temp_file = tempfile.NamedTemporaryFile() |
| 316 temp_file_name = temp_file.name | 317 temp_file_name = temp_file.name |
| 317 try: | 318 try: |
| 318 # Don't use '--non-interactive', since we want it to prompt for | 319 # Don't use '--non-interactive', since we want it to prompt for |
| 319 # crendentials if necessary. | 320 # crendentials if necessary. |
| 320 command = ['svn', 'checkout', '--depth', 'empty', | 321 command = ['svn', 'checkout', '--depth', 'empty', '-q', |
| 321 options.svn_repo, temp_dir] | 322 options.svn_repo, temp_dir] |
| 322 if options.email: | 323 if options.email: |
| 323 command += ['--username', options.email] | 324 command += ['--username', options.email] |
| 324 RunCommand(command) | 325 # Don't use RunCommand() since svn may prompt for information. |
| 326 use_shell = sys.platform.startswith("win") |
| 327 subprocess.Popen(command, shell=use_shell).communicate() |
| 328 |
| 325 # TODO(maruel): Use a subdirectory per user? | 329 # TODO(maruel): Use a subdirectory per user? |
| 326 current_time = str(datetime.datetime.now()).replace(':', '.') | 330 current_time = str(datetime.datetime.now()).replace(':', '.') |
| 327 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + | 331 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + |
| 328 '.%s.diff' % current_time) | 332 '.%s.diff' % current_time) |
| 329 full_path = os.path.join(temp_dir, file_name) | 333 full_path = os.path.join(temp_dir, file_name) |
| 330 full_url = options.svn_repo + '/' + file_name | 334 full_url = options.svn_repo + '/' + file_name |
| 331 file_found = False | 335 file_found = False |
| 332 try: | 336 try: |
| 333 RunCommand(['svn', 'ls', full_url]) | 337 RunCommand(['svn', 'ls', full_url]) |
| 334 file_found = True | 338 file_found = True |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if patch_name == 'Unnamed': | 536 if patch_name == 'Unnamed': |
| 533 print "Note: use --name NAME to change the try's name." | 537 print "Note: use --name NAME to change the try's name." |
| 534 except (InvalidScript, NoTryServerAccess), e: | 538 except (InvalidScript, NoTryServerAccess), e: |
| 535 if swallow_exception: | 539 if swallow_exception: |
| 536 return | 540 return |
| 537 print e | 541 print e |
| 538 | 542 |
| 539 | 543 |
| 540 if __name__ == "__main__": | 544 if __name__ == "__main__": |
| 541 TryChange(None, None, False) | 545 TryChange(None, None, False) |
| OLD | NEW |