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 import datetime | 10 import datetime |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 if options.dry_run: | 327 if options.dry_run: |
328 return | 328 return |
329 | 329 |
330 # Do an empty checkout. | 330 # Do an empty checkout. |
331 temp_dir = tempfile.mkdtemp() | 331 temp_dir = tempfile.mkdtemp() |
332 temp_file = tempfile.NamedTemporaryFile() | 332 temp_file = tempfile.NamedTemporaryFile() |
333 try: | 333 try: |
334 try: | 334 try: |
335 command = ['svn', 'checkout', '--depth', 'empty', '-q', | 335 command = ['svn', 'checkout', '--depth', 'empty', '-q', |
336 options.svn_repo, temp_dir] | 336 options.svn_repo, temp_dir] |
337 if options.email: | |
338 command.extend(['--username', options.email]) | |
339 gclient_utils.CheckCall(command) | 337 gclient_utils.CheckCall(command) |
340 | 338 |
341 # TODO(maruel): Use a subdirectory per user? | 339 # TODO(maruel): Use a subdirectory per user? |
342 current_time = str(datetime.datetime.now()).replace(':', '.') | 340 current_time = str(datetime.datetime.now()).replace(':', '.') |
343 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + | 341 file_name = (EscapeDot(options.user) + '.' + EscapeDot(options.name) + |
344 '.%s.diff' % current_time) | 342 '.%s.diff' % current_time) |
345 full_path = os.path.join(temp_dir, file_name) | 343 full_path = os.path.join(temp_dir, file_name) |
346 full_url = options.svn_repo + '/' + file_name | 344 full_url = options.svn_repo + '/' + file_name |
347 file_found = False | 345 file_found = False |
348 try: | 346 try: |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 except (InvalidScript, NoTryServerAccess), e: | 684 except (InvalidScript, NoTryServerAccess), e: |
687 if swallow_exception: | 685 if swallow_exception: |
688 return 1 | 686 return 1 |
689 print e | 687 print e |
690 return 1 | 688 return 1 |
691 return 0 | 689 return 0 |
692 | 690 |
693 | 691 |
694 if __name__ == "__main__": | 692 if __name__ == "__main__": |
695 sys.exit(TryChange(None, [], False)) | 693 sys.exit(TryChange(None, [], False)) |
OLD | NEW |