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 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 output = OptionallyDoPresubmitChecks(change_info, False, args) | 818 output = OptionallyDoPresubmitChecks(change_info, False, args) |
819 if not output.should_continue(): | 819 if not output.should_continue(): |
820 return 1 | 820 return 1 |
821 no_watchlists = (FilterFlag(args, "--no_watchlists") or | 821 no_watchlists = (FilterFlag(args, "--no_watchlists") or |
822 FilterFlag(args, "--no-watchlists")) | 822 FilterFlag(args, "--no-watchlists")) |
823 | 823 |
824 # Map --send-mail to --send_mail | 824 # Map --send-mail to --send_mail |
825 if FilterFlag(args, "--send-mail"): | 825 if FilterFlag(args, "--send-mail"): |
826 args.append("--send_mail") | 826 args.append("--send_mail") |
827 | 827 |
828 # Replace -m or --message with -t. | 828 # Replace -m with -t and --message with --title, but make sure to |
829 args = map(lambda a: '-t' if (a == '-m' or a == '--message') else a, args) | 829 # preserve anything after the -m/--message. |
830 | 830 found_deprecated_arg = [False] |
| 831 def replace_message(a): |
| 832 if a.startswith('-m'): |
| 833 found_deprecated_arg[0] = True |
| 834 return '-t' + a[2:] |
| 835 elif a.startswith('--message'): |
| 836 found_deprecated_arg[0] = True |
| 837 return '--title' + a[9:] |
| 838 return a |
| 839 args = map(replace_message, args) |
| 840 if found_deprecated_arg[0]: |
| 841 print >> sys.stderr, ( |
| 842 '\nWARNING: Use -t or --title to set the title of the patchset.\n' |
| 843 'In the near future, -m or --message will send a message instead.\n' |
| 844 'See http://goo.gl/JGg0Z for details.\n') |
831 | 845 |
832 upload_arg = ["upload.py", "-y"] | 846 upload_arg = ["upload.py", "-y"] |
833 upload_arg.append("--server=%s" % change_info.rietveld) | 847 upload_arg.append("--server=%s" % change_info.rietveld) |
834 | 848 |
835 reviewers = change_info.reviewers or output.reviewers | 849 reviewers = change_info.reviewers or output.reviewers |
836 if (reviewers and | 850 if (reviewers and |
837 not any(arg.startswith('-r') or arg.startswith('--reviewer') for | 851 not any(arg.startswith('-r') or arg.startswith('--reviewer') for |
838 arg in args)): | 852 arg in args)): |
839 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) | 853 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) |
840 | 854 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 raise | 1455 raise |
1442 print >> sys.stderr, ( | 1456 print >> sys.stderr, ( |
1443 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1457 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1444 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1458 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1445 return 1 | 1459 return 1 |
1446 | 1460 |
1447 | 1461 |
1448 if __name__ == "__main__": | 1462 if __name__ == "__main__": |
1449 fix_encoding.fix_encoding() | 1463 fix_encoding.fix_encoding() |
1450 sys.exit(main(sys.argv[1:])) | 1464 sys.exit(main(sys.argv[1:])) |
OLD | NEW |