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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 not options.diff and not options.url): | 513 not options.diff and not options.url): |
514 # TODO(maruel): It should just try the modified files showing up in a | 514 # TODO(maruel): It should just try the modified files showing up in a |
515 # svn status. | 515 # svn status. |
516 parser.error('Nothing to try, changelist is empty.') | 516 parser.error('Nothing to try, changelist is empty.') |
517 | 517 |
518 try: | 518 try: |
519 # Convert options.diff into the content of the diff. | 519 # Convert options.diff into the content of the diff. |
520 if options.url: | 520 if options.url: |
521 options.diff = urllib.urlopen(options.url).read() | 521 options.diff = urllib.urlopen(options.url).read() |
522 elif options.diff: | 522 elif options.diff: |
523 options.diff = gcl.ReadFile(options.diff) | 523 options.diff = gcl.gclient_utils.FileRead(options.diff, 'rb') |
524 # Process the VCS in any case at least to retrieve the email address. | 524 # Process the VCS in any case at least to retrieve the email address. |
525 try: | 525 try: |
526 options.scm = GuessVCS(options) | 526 options.scm = GuessVCS(options) |
527 options.scm.ProcessOptions() | 527 options.scm.ProcessOptions() |
528 except NoTryServerAccess, e: | 528 except NoTryServerAccess, e: |
529 # If we got the diff, we don't care. | 529 # If we got the diff, we don't care. |
530 if not options.diff: | 530 if not options.diff: |
531 # TODO(maruel): Raise what? | 531 # TODO(maruel): Raise what? |
532 raise | 532 raise |
533 | 533 |
(...skipping 27 matching lines...) Expand all Loading... |
561 except (InvalidScript, NoTryServerAccess), e: | 561 except (InvalidScript, NoTryServerAccess), e: |
562 if swallow_exception: | 562 if swallow_exception: |
563 return 1 | 563 return 1 |
564 print e | 564 print e |
565 return 1 | 565 return 1 |
566 return 0 | 566 return 0 |
567 | 567 |
568 | 568 |
569 if __name__ == "__main__": | 569 if __name__ == "__main__": |
570 sys.exit(TryChange(None, None, False)) | 570 sys.exit(TryChange(None, None, False)) |
OLD | NEW |