diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 78ea261f5..b848d2b9b 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -806,7 +806,7 @@ Raises: Returns a presubmit step. -— **def [execute](/recipes/recipe_modules/presubmit/api.py#100)(self, bot_update_step, skip_owners=False):** +— **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. -— **def [prepare](/recipes/recipe_modules/presubmit/api.py#65)(self):** +— **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. diff --git a/recipes/recipe_modules/presubmit/api.py b/recipes/recipe_modules/presubmit/api.py index 05c0cb070..75d1ec288 100644 --- a/recipes/recipe_modules/presubmit/api.py +++ b/recipes/recipe_modules/presubmit/api.py @@ -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)