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: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 4513d95..1fc3139 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -3122,6 +3122,19 @@
       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 @@
       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.