bot_update: Specify the target branch for patch_refs.

Bug: 870279
Recipe-Manual-Change: build
Recipe-Manual-Change: infra
Recipe-Manual-Change: build_limited_scripts_slave
Recipe-Manual-Change: skia
Recipe-Manual-Change: release_scripts
Change-Id: I58110ff8c5a6ca6906bbbf3eafa09dcbaf39f777
Reviewed-on: https://chromium-review.googlesource.com/1174988
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
This commit is contained in:
Edward Lemur
2018-09-05 20:51:03 +00:00
committed by Commit Bot
parent 7b9e6b1649
commit 01f0c698fb
17 changed files with 639 additions and 164 deletions

View File

@@ -138,15 +138,22 @@ class GerritApi(recipe_api.RecipeApi):
query_params=[('change', str(change))],
o_params=['ALL_REVISIONS', 'ALL_COMMITS'],
limit=1)
cl = cls[0] if len(cls) == 1 else {'revisions': {}}
for ri in cl['revisions'].itervalues():
if len(cls) != 1: # pragma: no cover
raise self.m.step.InfraFailure(
'Change not found: host:%r change:%r' % (host, change))
return self.extract_patchset_info(cls[0], patchset)
def extract_patchset_info(self, change_info, patchset):
for revision in change_info['revisions'].itervalues():
# TODO(tandrii): add support for patchset=='current'.
if str(ri['_number']) == str(patchset):
return ri
if str(revision['_number']) == str(patchset):
return revision
raise self.m.step.InfraFailure(
'Error querying for CL description: host:%r change:%r; patchset:%r' % (
host, change, patchset))
'Patchset %r not found for change %r' % (
patchset, change_info['_number']))
def get_changes(self, host, query_params, start=None, limit=None,
o_params=None, step_test_data=None, **kwargs):