Commit 6911b067 authored by andybons's avatar andybons Committed by Commit bot

Make rebase and sync the default for Gerrit updates.

BUG=602906
R=tandrii@chromium.org

Recipe-Tryjob-Bypass-Reason: tandrii@ takes responsibility.
Review-Url: https://codereview.chromium.org/2298883002
parent f3458f04
......@@ -50,6 +50,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
# The below method will be removed after there are no more callers of
# tryserver.maybe_apply_issue (skbug.com/5588).
def apply_gerrit_ref(self, root, gerrit_no_reset=False,
gerrit_no_rebase_patch_ref=False,
gerrit_rebase_patch_ref=True, **kwargs):
apply_gerrit_path = self.resource('apply_gerrit.py')
kwargs.setdefault('infra_step', True)
......@@ -63,8 +64,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
]
if gerrit_no_reset:
cmd.append('--gerrit_no_reset')
if gerrit_rebase_patch_ref:
cmd.append('--gerrit_rebase_patch_ref')
if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref:
cmd.append('--gerrit_no_rebase_patch_ref')
return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs)
def ensure_checkout(self, gclient_config=None, suffix=None,
......@@ -75,7 +76,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
output_manifest=True, clobber=False,
root_solution_revision=None, rietveld=None, issue=None,
patchset=None, gerrit_no_reset=False,
gerrit_rebase_patch_ref=False, **kwargs):
gerrit_no_rebase_patch_ref=False,
gerrit_rebase_patch_ref=True, **kwargs):
"""
Args:
use_site_config_creds: If the oauth2 credentials are in the buildbot
......@@ -231,8 +233,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
cmd.append('--with_branch_heads')
if gerrit_no_reset:
cmd.append('--gerrit_no_reset')
if gerrit_rebase_patch_ref:
cmd.append('--gerrit_rebase_patch_ref')
if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref:
cmd.append('--gerrit_no_rebase_patch_ref')
# Inject Json output for testing.
first_sln = cfg.solutions[0].name
......
......@@ -11,7 +11,7 @@
"--root",
"/tmp/test/root",
"--gerrit_no_reset",
"--gerrit_rebase_patch_ref"
"--gerrit_no_rebase_patch_ref"
],
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]"
......
......@@ -22,7 +22,7 @@
"/path/to/tmp/json",
"--revision",
"src@HEAD",
"--gerrit_rebase_patch_ref"
"--gerrit_no_rebase_patch_ref"
],
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]"
......
......@@ -34,13 +34,14 @@ def RunSteps(api):
root_solution_revision = api.properties.get('root_solution_revision')
suffix = api.properties.get('suffix')
gerrit_no_reset = True if api.properties.get('gerrit_no_reset') else False
gerrit_rebase_patch_ref = bool(api.properties.get('gerrit_rebase_patch_ref'))
gerrit_no_rebase_patch_ref = bool(
api.properties.get('gerrit_no_rebase_patch_ref'))
if api.properties.get('test_apply_gerrit_ref'):
api.bot_update.apply_gerrit_ref(
root='/tmp/test/root',
gerrit_no_reset=gerrit_no_reset,
gerrit_rebase_patch_ref=gerrit_rebase_patch_ref)
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
else:
api.bot_update.ensure_checkout(
force=force,
......@@ -53,7 +54,7 @@ def RunSteps(api):
root_solution_revision=root_solution_revision,
suffix=suffix,
gerrit_no_reset=gerrit_no_reset,
gerrit_rebase_patch_ref=gerrit_rebase_patch_ref)
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
def GenTests(api):
......@@ -158,15 +159,15 @@ def GenTests(api):
slavename='somehost',
gerrit_no_reset=1
)
yield api.test('gerrit_rebase_patch_ref') + api.properties(
yield api.test('gerrit_no_rebase_patch_ref') + api.properties(
mastername='experimental',
buildername='Experimental Builder',
slavename='somehost',
gerrit_rebase_patch_ref=True
gerrit_no_rebase_patch_ref=True
)
yield api.test('apply_gerrit_ref') + api.properties(
repository='chromium',
gerrit_rebase_patch_ref=True,
gerrit_no_rebase_patch_ref=True,
gerrit_no_reset=1,
test_apply_gerrit_ref=True,
)
......
......@@ -18,8 +18,8 @@ if __name__ == '__main__':
parse.add_option('--root', help='The location of the checkout.')
parse.add_option('--gerrit_no_reset', action='store_true',
help='Bypass calling reset after applying a gerrit ref.')
parse.add_option('--gerrit_rebase_patch_ref', action='store_true',
help='Rebase Gerrit patch ref after of checking it out.')
parse.add_option('--gerrit_no_rebase_patch_ref', action='store_true',
help='Bypass rebase of Gerrit patch ref after checkout.')
options, _ = parse.parse_args()
......@@ -29,5 +29,5 @@ if __name__ == '__main__':
options.gerrit_ref,
options.root,
not options.gerrit_no_reset,
options.gerrit_rebase_patch_ref)
not options.gerrit_no_rebase_patch_ref)
)
......@@ -1414,8 +1414,8 @@ def parse_args():
parse.add_option('--gerrit_repo',
help='Gerrit repository to pull the ref from.')
parse.add_option('--gerrit_ref', help='Gerrit ref to apply.')
parse.add_option('--gerrit_rebase_patch_ref', action='store_true',
help='Rebase Gerrit patch ref after of checking it out.')
parse.add_option('--gerrit_no_rebase_patch_ref', action='store_true',
help='Bypass rebase of Gerrit patch ref after checkout.')
parse.add_option('--gerrit_no_reset', action='store_true',
help='Bypass calling reset after applying a gerrit ref.')
parse.add_option('--specs', help='Gcilent spec.')
......@@ -1577,7 +1577,7 @@ def checkout(options, git_slns, specs, buildspec, master,
rietveld_server=options.rietveld_server,
gerrit_repo=options.gerrit_repo,
gerrit_ref=options.gerrit_ref,
gerrit_rebase_patch_ref=options.gerrit_rebase_patch_ref,
gerrit_rebase_patch_ref=not options.gerrit_no_rebase_patch_ref,
revision_mapping=options.revision_mapping,
apply_issue_email_file=options.apply_issue_email_file,
apply_issue_key_file=options.apply_issue_key_file,
......
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