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

Side by Side Diff: git_cl.py

Issue 2375393002: Revert of Add CC_LIST and --cc to Gerrit issues via API to be similar to CCs in Rietveld (Closed)
Patch Set: Created 4 years, 2 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 | « gerrit_util.py ('k') | 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 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 # reverse on its side. 2611 # reverse on its side.
2612 refspec_opts.append('m=' + options.title.replace(' ', '_')) 2612 refspec_opts.append('m=' + options.title.replace(' ', '_'))
2613 2613
2614 if options.send_mail: 2614 if options.send_mail:
2615 if not change_desc.get_reviewers(): 2615 if not change_desc.get_reviewers():
2616 DieWithError('Must specify reviewers to send email.') 2616 DieWithError('Must specify reviewers to send email.')
2617 refspec_opts.append('notify=ALL') 2617 refspec_opts.append('notify=ALL')
2618 else: 2618 else:
2619 refspec_opts.append('notify=NONE') 2619 refspec_opts.append('notify=NONE')
2620 2620
2621 cc = self.GetCCList().split(',')
2622 if options.cc:
2623 cc.extend(options.cc)
2624 cc = filter(None, cc)
2625 if cc:
2626 refspec_opts.extend('cc=' + email.strip() for email in cc)
2627
2621 reviewers = change_desc.get_reviewers() 2628 reviewers = change_desc.get_reviewers()
2622 if reviewers: 2629 if reviewers:
2623 refspec_opts.extend('r=' + email.strip() for email in reviewers) 2630 refspec_opts.extend('r=' + email.strip() for email in reviewers)
2624 2631
2625 if options.private: 2632 if options.private:
2626 refspec_opts.append('draft') 2633 refspec_opts.append('draft')
2627 2634
2628 if options.topic: 2635 if options.topic:
2629 # Documentation on Gerrit topics is here: 2636 # Documentation on Gerrit topics is here:
2630 # https://gerrit-review.googlesource.com/Documentation/user-upload.html#to pic 2637 # https://gerrit-review.googlesource.com/Documentation/user-upload.html#to pic
(...skipping 17 matching lines...) Expand all
2648 regex = re.compile(r'remote:\s+https?://[\w\-\.\/]*/(\d+)\s.*') 2655 regex = re.compile(r'remote:\s+https?://[\w\-\.\/]*/(\d+)\s.*')
2649 change_numbers = [m.group(1) 2656 change_numbers = [m.group(1)
2650 for m in map(regex.match, push_stdout.splitlines()) 2657 for m in map(regex.match, push_stdout.splitlines())
2651 if m] 2658 if m]
2652 if len(change_numbers) != 1: 2659 if len(change_numbers) != 1:
2653 DieWithError( 2660 DieWithError(
2654 ('Created|Updated %d issues on Gerrit, but only 1 expected.\n' 2661 ('Created|Updated %d issues on Gerrit, but only 1 expected.\n'
2655 'Change-Id: %s') % (len(change_numbers), change_id)) 2662 'Change-Id: %s') % (len(change_numbers), change_id))
2656 self.SetIssue(change_numbers[0]) 2663 self.SetIssue(change_numbers[0])
2657 self._GitSetBranchConfigValue('gerritsquashhash', ref_to_push) 2664 self._GitSetBranchConfigValue('gerritsquashhash', ref_to_push)
2658
2659 # Add cc's from the CC_LIST and --cc flag (if any).
2660 cc = self.GetCCList().split(',')
2661 if options.cc:
2662 cc.extend(options.cc)
2663 cc = filter(None, cc)
2664 if cc:
2665 gerrit_util.AddReviewers(
2666 self._GetGerritHost(), self.GetIssue(), cc, is_reviewer=False)
2667
2668 return 0 2665 return 0
2669 2666
2670 def _AddChangeIdToCommitMessage(self, options, args): 2667 def _AddChangeIdToCommitMessage(self, options, args):
2671 """Re-commits using the current message, assumes the commit hook is in 2668 """Re-commits using the current message, assumes the commit hook is in
2672 place. 2669 place.
2673 """ 2670 """
2674 log_desc = options.message or CreateDescriptionFromLog(args) 2671 log_desc = options.message or CreateDescriptionFromLog(args)
2675 git_command = ['commit', '--amend', '-m', log_desc] 2672 git_command = ['commit', '--amend', '-m', log_desc]
2676 RunGit(git_command) 2673 RunGit(git_command)
2677 new_log_desc = CreateDescriptionFromLog(args) 2674 new_log_desc = CreateDescriptionFromLog(args)
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
5299 if __name__ == '__main__': 5296 if __name__ == '__main__':
5300 # These affect sys.stdout so do it outside of main() to simplify mocks in 5297 # These affect sys.stdout so do it outside of main() to simplify mocks in
5301 # unit testing. 5298 # unit testing.
5302 fix_encoding.fix_encoding() 5299 fix_encoding.fix_encoding()
5303 setup_color.init() 5300 setup_color.init()
5304 try: 5301 try:
5305 sys.exit(main(sys.argv[1:])) 5302 sys.exit(main(sys.argv[1:]))
5306 except KeyboardInterrupt: 5303 except KeyboardInterrupt:
5307 sys.stderr.write('interrupted\n') 5304 sys.stderr.write('interrupted\n')
5308 sys.exit(1) 5305 sys.exit(1)
OLDNEW
« no previous file with comments | « gerrit_util.py ('k') | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698