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

Unified Diff: git_cl.py

Issue 13800021: Update the R= line with the actual list of reviewers that approved the CL. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@3_gcl_refactor
Patch Set: rebase Created 7 years, 8 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 | « gcl.py ('k') | tests/gcl_unittest.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 ce7c6df12595df173b196555d64144ae51bb4493..7b708fc5b35b4cad7892343678d6ebaacb66ed40 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -647,6 +647,10 @@ or verify this branch is set up to track another (via the --track argument to
return self.RpcServer().get(
'/download/issue%s_%s.diff' % (issue, patchset))
+ def GetApprovingReviewers(self, issue):
+ return get_approving_reviewers(
+ self.RpcServer().get_issue_properties(int(issue), True))
+
def SetIssue(self, issue):
"""Set this branch's issue. If issue=0, clears the issue."""
if issue:
@@ -873,6 +877,22 @@ class ChangeDescription(object):
return cleanup_list(reviewers)
+def get_approving_reviewers(props):
+ """Retrieves the reviewers that approved a CL from the issue properties with
+ messages.
+
+ Note that the list may contain reviewers that are not committer, thus are not
+ considered by the CQ.
+ """
+ return sorted(
+ set(
+ message['sender']
+ for message in props['messages']
+ if message['approval'] and message['sender'] in props['reviewers']
+ )
+ )
+
+
def FindCodereviewSettingsFile(filename='codereview.settings'):
"""Finds the given file starting in the cwd and going up.
@@ -1486,6 +1506,10 @@ def SendUpstream(parser, args, cmd):
# Keep a separate copy for the commit message, because the commit message
# contains the link to the Rietveld issue, while the Rietveld message contains
# the commit viewvc url.
+ # Keep a separate copy for the commit message.
+ if cl.GetIssue():
+ change_desc.update_reviewers(cl.GetApprovingReviewers(cl.GetIssue()))
+
commit_desc = ChangeDescription(change_desc.description)
if cl.GetIssue():
commit_desc.append_footer('Review URL: %s' % cl.GetIssueURL())
« no previous file with comments | « gcl.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698