| 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. |
| 829 args = map(lambda a: '-t' if (a == '-m' or a == '--message') else a, args) |
| 830 |
| 831 |
| 828 upload_arg = ["upload.py", "-y"] | 832 upload_arg = ["upload.py", "-y"] |
| 829 upload_arg.append("--server=%s" % change_info.rietveld) | 833 upload_arg.append("--server=%s" % change_info.rietveld) |
| 830 | 834 |
| 831 reviewers = change_info.reviewers or output.reviewers | 835 reviewers = change_info.reviewers or output.reviewers |
| 832 if (reviewers and | 836 if (reviewers and |
| 833 not any(arg.startswith('-r') or arg.startswith('--reviewer') for | 837 not any(arg.startswith('-r') or arg.startswith('--reviewer') for |
| 834 arg in args)): | 838 arg in args)): |
| 835 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) | 839 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) |
| 836 | 840 |
| 837 upload_arg.extend(args) | 841 upload_arg.extend(args) |
| 838 | 842 |
| 839 desc_file = None | 843 desc_file = None |
| 840 try: | 844 try: |
| 841 if change_info.issue: | 845 if change_info.issue: |
| 842 # Uploading a new patchset. | 846 # Uploading a new patchset. |
| 843 upload_arg.append("--issue=%d" % change_info.issue) | 847 upload_arg.append("--issue=%d" % change_info.issue) |
| 844 | 848 |
| 845 if not any(i.startswith('--message') or i.startswith('-m') for i in args): | 849 if not any(i.startswith('--title') or i.startswith('-t') for i in args): |
| 846 upload_arg.append('--title= ') | 850 upload_arg.append('--title= ') |
| 847 else: | 851 else: |
| 848 # First time we upload. | 852 # First time we upload. |
| 849 handle, desc_file = tempfile.mkstemp(text=True) | 853 handle, desc_file = tempfile.mkstemp(text=True) |
| 850 os.write(handle, change_info.description) | 854 os.write(handle, change_info.description) |
| 851 os.close(handle) | 855 os.close(handle) |
| 852 | 856 |
| 853 # Watchlist processing -- CC people interested in this changeset | 857 # Watchlist processing -- CC people interested in this changeset |
| 854 # http://dev.chromium.org/developers/contributing-code/watchlists | 858 # http://dev.chromium.org/developers/contributing-code/watchlists |
| 855 if not no_watchlists: | 859 if not no_watchlists: |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 raise | 1441 raise |
| 1438 print >> sys.stderr, ( | 1442 print >> sys.stderr, ( |
| 1439 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1443 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1440 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1444 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
| 1441 return 1 | 1445 return 1 |
| 1442 | 1446 |
| 1443 | 1447 |
| 1444 if __name__ == "__main__": | 1448 if __name__ == "__main__": |
| 1445 fix_encoding.fix_encoding() | 1449 fix_encoding.fix_encoding() |
| 1446 sys.exit(main(sys.argv[1:])) | 1450 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |