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

Unified Diff: infra/libs/gerrit_api/gerrit_api.py

Issue 2185653002: gerrit_api: add on_behalf_of to set_review method. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@tag-631471
Patch Set: Created 4 years, 5 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 | infra/libs/gerrit_api/test/gerrit_api_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/libs/gerrit_api/gerrit_api.py
diff --git a/infra/libs/gerrit_api/gerrit_api.py b/infra/libs/gerrit_api/gerrit_api.py
index 1f29d69851b21980ebd3394645d144a9799b06ca..8b3917934b4b03528d7b55882555a3411d9bf072 100644
--- a/infra/libs/gerrit_api/gerrit_api.py
+++ b/infra/libs/gerrit_api/gerrit_api.py
@@ -429,9 +429,11 @@ class Gerrit(object):
@_not_read_only
def set_review(self, change_id, revision_id, message=None, labels=None,
- notify=NOTIFY_NONE, max_message=300, tag=None):
+ notify=NOTIFY_NONE, max_message=300, tag=None,
+ on_behalf_of=None):
"""Uses the Set Review endpoint of the Gerrit API to add messages and/or set
labels for a patchset.
+
Documentation:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
@@ -441,8 +443,10 @@ class Gerrit(object):
message: (str) The message to add to the patchset.
labels: (dict) The dictionary which maps label names to their new value.
notify: (str) Who should get a notification.
- tag: (str) Apply this tag to the review comment message and labels(votes):
+ tag: (str) Apply this tag to the review comment message and labels (votes)
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
+ on_behalf_of: (str) The account_id of the user on whose behalf to set
+ labels.
"""
if message:
tail = u'\n(message too large)'
@@ -451,7 +455,8 @@ class Gerrit(object):
logging.info('change_id: %s; comment: %s' % (change_id, message.strip()))
payload = {}
for var, attr in [(message, 'message'), (notify, 'notify'),
- (labels, 'labels'), (tag, 'tag')]:
+ (labels, 'labels'), (tag, 'tag'),
+ (on_behalf_of, 'on_behalf_of')]:
if var is not None:
payload[attr] = var
code, body = self._request(
« no previous file with comments | « no previous file | infra/libs/gerrit_api/test/gerrit_api_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698