Commit 76988a8c authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

git cl: compute reviewers and ccs before pushing change to Gerrit.

R=ehmaldonado

Bug: 877717
Change-Id: Iccfba594369d8c726fd9b077d3ac18046757e4a2
Reviewed-on: https://chromium-review.googlesource.com/c/1242845
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent dd788444
......@@ -3122,6 +3122,19 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
change_desc.update_reviewers(options.reviewers, options.tbrs,
options.add_owners_to, change)
# TODO(tandrii): process reviewers and ccs into refspec.
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 = []
if options.cc:
cc.extend(options.cc)
cc = filter(None, [email.strip() for email in cc])
if change_desc.get_cced():
cc.extend(change_desc.get_cced())
# Extra options that can be specified at push time. Doc:
# https://gerrit-review.googlesource.com/Documentation/user-upload.html
refspec_opts = []
......@@ -3247,19 +3260,6 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
self.SetIssue(change_numbers[0])
self._GitSetBranchConfigValue('gerritsquashhash', ref_to_push)
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 = []
if options.cc:
cc.extend(options.cc)
cc = filter(None, [email.strip() for email in cc])
if change_desc.get_cced():
cc.extend(change_desc.get_cced())
if self.GetIssue():
# GetIssue() is not set in case of non-squash uploads according to tests.
# TODO(agable): non-squash uploads in git cl should be removed.
......
......@@ -1261,6 +1261,10 @@ class TestGitCl(TestCase):
if title:
ref_suffix += ',m=' + title
calls += [
((['git', 'config', 'rietveld.cc'],), ''),
]
calls.append((
(['git', 'push',
'https://chromium.googlesource.com/my/repo',
......@@ -1289,9 +1293,6 @@ class TestGitCl(TestCase):
((['git', 'config', 'branch.master.gerritsquashhash',
'abcdef0123456789'],), ''),
]
calls += [
((['git', 'config', 'rietveld.cc'],), ''),
]
if squash:
calls += [
(('AddReviewers',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment