Commit 5aa5cd76 authored by Sergey Berezin's avatar Sergey Berezin Committed by Commit Bot

depot_tools: add gerrit repo and ref to apply_gerrit_ref()

The only user of this method needs to apply two patches from two
different repos in a try job. Extending the method to handle this.

BUG=628259
R=agable@chromium.org

Change-Id: Ia119780d1323add0094631e5c291b0e7a573e6e5
Reviewed-on: https://chromium-review.googlesource.com/588008
Commit-Queue: Sergey Berezin <sergeyberezin@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 56766f1d
......@@ -47,14 +47,14 @@ Recipe module to ensure a checkout is consistent on a bot.
Wrapper for easy calling of bot_update.
&mdash; **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#49)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, \*\*kwargs):**
&mdash; **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#49)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, \*\*kwargs):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#427)(self, bot_update_step):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#428)(self, bot_update_step):**
Deapplies a patch, taking care of DEPS and solution revisions properly.
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#69)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=True, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, \*\*kwargs):**
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#70)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=True, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, \*\*kwargs):**
Args:
use_site_config_creds: If the oauth2 credentials are in the buildbot
......@@ -71,7 +71,7 @@ Args:
Needed as migration paths for recipes dealing with older revisions,
such as bisect.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#404)(self, project_name, gclient_config=None):**
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#405)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of
a given project.
......
......@@ -47,12 +47,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
# DO NOT USE.
# TODO(tandrii): refactor this into tryserver.maybe_apply_patch
def apply_gerrit_ref(self, root, gerrit_no_reset=False,
gerrit_no_rebase_patch_ref=False, **kwargs):
gerrit_no_rebase_patch_ref=False,
gerrit_repo=None, gerrit_ref=None, **kwargs):
apply_gerrit_path = self.resource('apply_gerrit.py')
kwargs.setdefault('infra_step', True)
cmd = [
'--gerrit_repo', self._repository,
'--gerrit_ref', self._gerrit_ref or '',
'--gerrit_repo', gerrit_repo or self._repository,
'--gerrit_ref', gerrit_ref or self._gerrit_ref or '',
'--root', str(root),
]
if gerrit_no_reset:
......
[
{
"cmd": [
"python",
"-u",
"RECIPE_MODULE[depot_tools::bot_update]/resources/apply_gerrit.py",
"--gerrit_repo",
"https://custom/repo",
"--gerrit_ref",
"refs/changes/custom/1234567/1",
"--root",
"/tmp/test/root",
"--gerrit_no_reset",
"--gerrit_no_rebase_patch_ref"
],
"env_prefixes": {
"PATH": [
"RECIPE_PACKAGE_REPO[depot_tools]"
]
},
"infra_step": true,
"name": "apply_gerrit"
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
......@@ -51,7 +51,10 @@ def RunSteps(api):
api.bot_update.apply_gerrit_ref(
root='/tmp/test/root',
gerrit_no_reset=gerrit_no_reset,
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref,
gerrit_repo=api.properties.get('gerrit_custom_repo'),
gerrit_ref=api.properties.get('gerrit_custom_ref'),
)
else:
bot_update_step = api.bot_update.ensure_checkout(
no_shallow=no_shallow,
......@@ -156,6 +159,14 @@ def GenTests(api):
gerrit_no_reset=1,
test_apply_gerrit_ref=True,
)
yield api.test('apply_gerrit_ref_custom') + api.properties(
repository='chromium',
gerrit_no_rebase_patch_ref=True,
gerrit_no_reset=1,
gerrit_custom_repo='https://custom/repo',
gerrit_custom_ref='refs/changes/custom/1234567/1',
test_apply_gerrit_ref=True,
)
yield api.test('tryjob_v8') + api.properties(
issue=12345,
patchset=654321,
......
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