Commit 04065d39 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

Reland "bot_update: Fetch references to be synced."

This is a reland of 3806b7fb

Original change's description:
> bot_update: Fetch references to be synced.
>
> If a solution is to be synced to a reference, such as
> refs/branch-heads/#### fetch it so that it can later be
> checked out.
>
> I tried this change on a LUCI task that runs chromium_presubmit
> for crrev.com/c/1048868. The bot_update works as expected:
> https://ci.chromium.org/swarming/task/3d5b294cff467710?server=chromium-swarm.appspot.com
>
>
> Bug: 840445
>
> Change-Id: I6444c0feb679ca89b2f4065215de915494e5082a
> Recipe-Nontrivial-Roll: infra
> Recipe-Nontrivial-Roll: build
> Recipe-Nontrivial-Roll: build_limited
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Reviewed-on: https://chromium-review.googlesource.com/1049007
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>

Bug: 840445

Recipe-Nontrivial-Roll: infra
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Change-Id: I64a97aafe5fab9a26c478262e9ca104dc59e61f5
Reviewed-on: https://chromium-review.googlesource.com/1052387
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
parent b61d387f
......@@ -48,7 +48,7 @@ Wrapper for easy calling of bot_update.
&mdash; **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#47)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, step_name='apply_gerrit', \*\*kwargs):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#397)(self, bot_update_step):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#399)(self, bot_update_step):**
Deapplies a patch, taking care of DEPS and solution revisions properly.
......@@ -64,7 +64,7 @@ Args:
manifest_name: The name of the manifest to upload to LogDog. This must
be unique for the whole build.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#374)(self, project_name, gclient_config=None):**
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#376)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of
a given project.
......
......@@ -183,6 +183,12 @@ class BotUpdateApi(recipe_api.RecipeApi):
if fixed_revision.upper() == 'HEAD':
# Sync to correct destination branch if HEAD was specified.
fixed_revision = self._destination_branch(cfg, name)
# If we're syncing to a ref, we want to make sure it exists before
# trying to check it out.
if fixed_revision.startswith('refs/'):
# Handle the "ref:revision" syntax, e.g.
# refs/branch-heads/4.2:deadbeef
refs.append(fixed_revision.split(':')[0])
flags.append(['--revision', '%s@%s' % (name, fixed_revision)])
# Add extra fetch refspecs.
......
......@@ -222,6 +222,14 @@ def GenTests(api):
'gerrit get_patch_destination_branch',
api.gerrit.get_one_change_response_data(branch='experimental/feature'),
)
yield api.test('tryjob_gerrit_branch_heads') + api.properties.tryserver(
gerrit_project='chromium/src',
patch_issue=338811,
patch_set=3,
) + api.step_data(
'gerrit get_patch_destination_branch',
api.gerrit.get_one_change_response_data(branch='refs/branch-heads/67'),
)
yield api.test('tryjob_gerrit_angle_deprecated') + api.properties.tryserver(
patch_project='angle/angle',
gerrit='https://chromium-review.googlesource.com',
......
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