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 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
9 | 9 |
10 from __future__ import print_function | 10 from __future__ import print_function |
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 ask_for_data('About to upload; enter to confirm.') | 2510 ask_for_data('About to upload; enter to confirm.') |
2511 | 2511 |
2512 if options.reviewers or options.tbr_owners: | 2512 if options.reviewers or options.tbr_owners: |
2513 change_desc.update_reviewers(options.reviewers, options.tbr_owners, | 2513 change_desc.update_reviewers(options.reviewers, options.tbr_owners, |
2514 change) | 2514 change) |
2515 | 2515 |
2516 # Extra options that can be specified at push time. Doc: | 2516 # Extra options that can be specified at push time. Doc: |
2517 # https://gerrit-review.googlesource.com/Documentation/user-upload.html | 2517 # https://gerrit-review.googlesource.com/Documentation/user-upload.html |
2518 refspec_opts = [] | 2518 refspec_opts = [] |
2519 if options.title: | 2519 if options.title: |
| 2520 if not re.match(r'^[\w ]+$', options.title): |
| 2521 options.title = re.sub(r'[^\w ]', '', options.title) |
| 2522 print('WARNING: Patchset title may only contain alphanumeric chars ' |
| 2523 'and spaces. Cleaned up title:\n%s' % options.title) |
| 2524 if not options.force: |
| 2525 ask_for_data('Press enter to continue, Ctrl+C to abort') |
2520 # Per doc, spaces must be converted to underscores, and Gerrit will do the | 2526 # Per doc, spaces must be converted to underscores, and Gerrit will do the |
2521 # reverse on its side. | 2527 # reverse on its side. |
2522 if '_' in options.title: | |
2523 print('WARNING: underscores in title will be converted to spaces.') | |
2524 refspec_opts.append('m=' + options.title.replace(' ', '_')) | 2528 refspec_opts.append('m=' + options.title.replace(' ', '_')) |
2525 | 2529 |
2526 if options.send_mail: | 2530 if options.send_mail: |
2527 if not change_desc.get_reviewers(): | 2531 if not change_desc.get_reviewers(): |
2528 DieWithError('Must specify reviewers to send email.') | 2532 DieWithError('Must specify reviewers to send email.') |
2529 refspec_opts.append('notify=ALL') | 2533 refspec_opts.append('notify=ALL') |
2530 else: | 2534 else: |
2531 refspec_opts.append('notify=NONE') | 2535 refspec_opts.append('notify=NONE') |
2532 | 2536 |
2533 cc = self.GetCCList().split(',') | 2537 cc = self.GetCCList().split(',') |
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5105 if __name__ == '__main__': | 5109 if __name__ == '__main__': |
5106 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5110 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5107 # unit testing. | 5111 # unit testing. |
5108 fix_encoding.fix_encoding() | 5112 fix_encoding.fix_encoding() |
5109 setup_color.init() | 5113 setup_color.init() |
5110 try: | 5114 try: |
5111 sys.exit(main(sys.argv[1:])) | 5115 sys.exit(main(sys.argv[1:])) |
5112 except KeyboardInterrupt: | 5116 except KeyboardInterrupt: |
5113 sys.stderr.write('interrupted\n') | 5117 sys.stderr.write('interrupted\n') |
5114 sys.exit(1) | 5118 sys.exit(1) |
OLD | NEW |