git-cl: Set CC from watchlists only on first upload

This will prevent moving reviewers to cc when uploading patches.

Bug: 1010499
Change-Id: Ida16a4686f46350ba009bdaec1542895208c3f2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1835016
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
changes/16/1835016/13
Edward Lemur 6 years ago committed by Commit Bot
parent b295105c22
commit 4508b4223b

@ -2540,11 +2540,12 @@ class Changelist(object):
options.add_owners_to, change)
reviewers = sorted(change_desc.get_reviewers())
# Add cc's from the CC_LIST and --cc flag (if any).
if not options.private and not options.no_autocc:
cc = self.GetCCList().split(',')
else:
cc = []
# Add CCs from WATCHLISTS and rietveld.cc git config unless this is
# the initial upload, the CL is private, or auto-CCing has ben disabled.
if not (self.GetIssue() or options.private or options.no_autocc):
cc = self.GetCCList().split(',')
# Add cc's from the --cc flag.
if options.cc:
cc.extend(options.cc)
cc = filter(None, [email.strip() for email in cc])

@ -1062,6 +1062,7 @@ class TestGitCl(TestCase):
ref_suffix += ',m=' + title
metrics_arguments.append('m')
if issue is None:
calls += [
((['git', 'config', 'rietveld.cc'],), ''),
]
@ -1070,8 +1071,9 @@ class TestGitCl(TestCase):
for r in sorted(reviewers):
ref_suffix += ',r=%s' % r
metrics_arguments.append('r')
for c in sorted(['chromium-reviews+test-more-cc@chromium.org',
'joe@example.com'] + cc):
if issue is None:
cc += ['chromium-reviews+test-more-cc@chromium.org', 'joe@example.com']
for c in sorted(cc):
ref_suffix += ',cc=%s' % c
metrics_arguments.append('cc')
reviewers, cc = [], []
@ -1091,7 +1093,9 @@ class TestGitCl(TestCase):
ref_suffix += ',r=%s' % r
metrics_arguments.append('r')
reviewers.remove(r)
for c in sorted(['joe@example.com'] + cc):
if issue is None:
cc += ['joe@example.com']
for c in sorted(cc):
ref_suffix += ',cc=%s' % c
metrics_arguments.append('cc')
if c in cc:

Loading…
Cancel
Save