Commit 08f3e313 authored by Rakib M. Hasan's avatar Rakib M. Hasan Committed by LUCI CQ

Allow users to specify the revision of the root solution checkout

This CL allows users to pass the root solution revision to the bot
update step for presubmits. The presubmit for some child repositories
of src have dependencies on src. We need to make sure that the same
branch of a src and child repositories are checked out.

Bug:1238418
Change-Id: If2ea3962d764bddd17b3d17d20e7c644f4065fe0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3085094Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
Reviewed-by: 's avatarGarrett Beaty <gbeaty@chromium.org>
Commit-Queue: Rakib Hasan <rmhasan@google.com>
parent f406fda0
......@@ -806,7 +806,7 @@ Raises:
Returns a presubmit step.
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#100)(self, bot_update_step, skip_owners=False):**
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#110)(self, bot_update_step, skip_owners=False):**
Runs presubmit and sets summary markdown if applicable.
......@@ -817,7 +817,7 @@ Args:
Returns:
a RawResult object, suitable for being returned from RunSteps.
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#65)(self):**
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#65)(self, root_solution_revision=None):**
Sets up a presubmit run.
......@@ -828,6 +828,9 @@ This includes:
This expects the gclient configuration to already have been set.
Args:
root_solution_revision: revision of the root solution
Returns:
the StepResult from the bot_update step.
......
......@@ -62,7 +62,7 @@ class PresubmitApi(recipe_api.RecipeApi):
output[key] = output2[key]
return output
def prepare(self):
def prepare(self, root_solution_revision=None):
"""Sets up a presubmit run.
This includes:
......@@ -72,13 +72,23 @@ class PresubmitApi(recipe_api.RecipeApi):
This expects the gclient configuration to already have been set.
Args:
root_solution_revision: revision of the root solution
Returns:
the StepResult from the bot_update step.
"""
# Expect callers to have already set up their gclient configuration.
# Set up the root solution revision by either passing the revision
# to this function or adding it to the input properties.
root_solution_revision = (
root_solution_revision or
self.m.properties.get('root_solution_revision'))
# Expect callers to have already set up their gclient configuration.
bot_update_step = self.m.bot_update.ensure_checkout(
timeout=3600, no_fetch_tags=True)
timeout=3600, no_fetch_tags=True,
root_solution_revision=root_solution_revision)
relative_root = self.m.gclient.get_gerrit_patch_root().rstrip('/')
abs_root = self.m.context.cwd.join(relative_root)
......
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