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

Unified Diff: git_cl.py

Issue 2433323004: Automatically CC folks listed in CC= lines. (Closed)
Patch Set: added tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index c78207bdc9ee4f1ab1541ec1ca74238d8621b377..5b0f00aeecec04589a5db91d4352584c79de5f73 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2125,6 +2125,8 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
else:
cc = self.GetCCList()
cc = ','.join(filter(None, (cc, ','.join(options.cc))))
+ if change_desc.get_cced():
+ cc = ','.join(filter(None, (cc, ','.join(change_desc.get_cced()))))
if cc:
upload_args.extend(['--cc', cc])
@@ -2772,6 +2774,8 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
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 cc:
gerrit_util.AddReviewers(
self._GetGerritHost(), self.GetIssue(), cc, is_reviewer=False)
@@ -2898,6 +2902,7 @@ def _get_bug_line_values(default_project, bugs):
class ChangeDescription(object):
"""Contains a parsed form of the change description."""
R_LINE = r'^[ \t]*(TBR|R)[ \t]*=[ \t]*(.*?)[ \t]*$'
+ CC_LINE = r'^[ \t]*(CC)[ \t]*=[ \t]*(.*?)[ \t]*$'
BUG_LINE = r'^[ \t]*(BUG)[ \t]*=[ \t]*(.*?)[ \t]*$'
def __init__(self, description):
@@ -3045,6 +3050,12 @@ class ChangeDescription(object):
if match and (not tbr_only or match.group(1).upper() == 'TBR')]
return cleanup_list(reviewers)
+ def get_cced(self):
+ """Retrieves the list of reviewers."""
+ matches = [re.match(self.CC_LINE, line) for line in self._description_lines]
+ cced = [match.group(2).strip() for match in matches if match]
+ return cleanup_list(cced)
+
def get_approving_reviewers(props):
"""Retrieves the reviewers that approved a CL from the issue properties with
« 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