Commit 66c97844 authored by Xinan Lin's avatar Xinan Lin Committed by LUCI CQ

Add cc_list to update_files method

User could attach CC addresses to the gerrit change created.

BUG=1294382
TEST=train

Change-Id: I236658d80f41b27bf007bb344934ce835cd7b5de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3440862Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
parent 33d87bca
......@@ -349,7 +349,7 @@ Returns:
&mdash; **def [set\_change\_label](/recipes/recipe_modules/gerrit/api.py#277)(self, host, change, label_name, label_value, name=None, step_test_data=None):**
&mdash; **def [update\_files](/recipes/recipe_modules/gerrit/api.py#319)(self, host, project, branch, new_contents_by_file_path, commit_msg, params=frozenset(['status=NEW']), submit=False, submit_later=False):**
&mdash; **def [update\_files](/recipes/recipe_modules/gerrit/api.py#319)(self, host, project, branch, new_contents_by_file_path, commit_msg, params=frozenset(['status=NEW']), cc_list=frozenset([]), submit=False, submit_later=False):**
Update a set of files by creating and submitting a Gerrit CL.
......@@ -362,6 +362,7 @@ Args:
* commit_msg: Description to add to the CL.
* params: A list of additional ChangeInput specifiers, with format
'key=value'.
* cc_list: A list of addresses to notify.
* submit: Should land this CL instantly.
* submit_later: If this change has related CLs, we may want to commit
them in a chain. So only set Bot-Commit+1, making it ready for
......
......@@ -323,6 +323,7 @@ class GerritApi(recipe_api.RecipeApi):
new_contents_by_file_path,
commit_msg,
params=frozenset(['status=NEW']),
cc_list=frozenset([]),
submit=False,
submit_later=False):
"""Update a set of files by creating and submitting a Gerrit CL.
......@@ -336,6 +337,7 @@ class GerritApi(recipe_api.RecipeApi):
* commit_msg: Description to add to the CL.
* params: A list of additional ChangeInput specifiers, with format
'key=value'.
* cc_list: A list of addresses to notify.
* submit: Should land this CL instantly.
* submit_later: If this change has related CLs, we may want to commit
them in a chain. So only set Bot-Commit+1, making it ready for
......@@ -364,6 +366,8 @@ class GerritApi(recipe_api.RecipeApi):
]
for p in params:
command.extend(['-p', p])
for cc in cc_list:
command.extend(['--cc', cc])
step_result = self('create change at (%s %s)' % (project, branch), command)
change = int(step_result.json.output.get('_number'))
step_result.presentation.links['change %d' %
......
......@@ -187,7 +187,9 @@
"--json_file",
"/path/to/tmp/json",
"-p",
"status=NEW"
"status=NEW",
"--cc",
"foo@example.com"
],
"env": {
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
......
......@@ -44,7 +44,8 @@ def RunSteps(api):
'main',
{'chrome/VERSION': '99.99.99.99'},
'Dummy CL.',
submit=True)
submit=True,
cc_list=['foo@example.com'])
assert int(change_info['_number']) == 91827, change_info
assert change_info['status'] == 'MERGED'
......
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