Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: git_cl.py

Issue 2252043002: Gerrit git cl upload: auto-filter patchset titles. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698