OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 | 5 |
6 """Client-side script to send a try job to the try server. It communicates to | 6 """Client-side script to send a try job to the try server. It communicates to |
7 the try server by either writting to a svn repository or by directly connecting | 7 the try server by either writting to a svn repository or by directly connecting |
8 to the server by HTTP. | 8 to the server by HTTP. |
9 """ | 9 """ |
10 | 10 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 diff = GetMungedDiff('', urllib.urlopen(diff_url).readlines()) | 780 diff = GetMungedDiff('', urllib.urlopen(diff_url).readlines()) |
781 options.diff = ''.join(diff[0]) | 781 options.diff = ''.join(diff[0]) |
782 changed_files = diff[1] | 782 changed_files = diff[1] |
783 else: | 783 else: |
784 # Use this as the base. | 784 # Use this as the base. |
785 root = checkouts[0].checkout_root | 785 root = checkouts[0].checkout_root |
786 diffs = [] | 786 diffs = [] |
787 for checkout in checkouts: | 787 for checkout in checkouts: |
788 raw_diff = checkout.GenerateDiff() | 788 raw_diff = checkout.GenerateDiff() |
789 if not raw_diff: | 789 if not raw_diff: |
790 logging.error('Empty or non-existant diff, exiting.') | 790 continue |
791 return 1 | |
792 diff = raw_diff.splitlines(True) | 791 diff = raw_diff.splitlines(True) |
793 path_diff = gclient_utils.PathDifference(root, checkout.checkout_root) | 792 path_diff = gclient_utils.PathDifference(root, checkout.checkout_root) |
794 # Munge it. | 793 # Munge it. |
795 diffs.extend(GetMungedDiff(path_diff, diff)[0]) | 794 diffs.extend(GetMungedDiff(path_diff, diff)[0]) |
| 795 if not diffs: |
| 796 logging.error('Empty or non-existant diff, exiting.') |
| 797 return 1 |
796 options.diff = ''.join(diffs) | 798 options.diff = ''.join(diffs) |
797 | 799 |
798 if not options.name: | 800 if not options.name: |
799 if options.issue: | 801 if options.issue: |
800 options.name = 'Issue %s' % options.issue | 802 options.name = 'Issue %s' % options.issue |
801 else: | 803 else: |
802 options.name = 'Unnamed' | 804 options.name = 'Unnamed' |
803 print('Note: use --name NAME to change the try job name.') | 805 print('Note: use --name NAME to change the try job name.') |
804 | 806 |
805 if not options.email: | 807 if not options.email: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 return 1 | 886 return 1 |
885 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 887 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
886 print >> sys.stderr, e | 888 print >> sys.stderr, e |
887 return 1 | 889 return 1 |
888 return 0 | 890 return 0 |
889 | 891 |
890 | 892 |
891 if __name__ == "__main__": | 893 if __name__ == "__main__": |
892 fix_encoding.fix_encoding() | 894 fix_encoding.fix_encoding() |
893 sys.exit(TryChange(None, None, False)) | 895 sys.exit(TryChange(None, None, False)) |
OLD | NEW |