diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py index 7e84b8508e..d88d929938 100644 --- a/recipe_modules/bot_update/api.py +++ b/recipe_modules/bot_update/api.py @@ -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 diff --git a/recipe_modules/bot_update/example.expected/apply_gerrit_ref.json b/recipe_modules/bot_update/example.expected/apply_gerrit_ref.json index f4bf481861..342885c263 100644 --- a/recipe_modules/bot_update/example.expected/apply_gerrit_ref.json +++ b/recipe_modules/bot_update/example.expected/apply_gerrit_ref.json @@ -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]" diff --git a/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json b/recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json similarity index 96% rename from recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json rename to recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json index 2d4257e772..d919addcdc 100644 --- a/recipe_modules/bot_update/example.expected/gerrit_rebase_patch_ref.json +++ b/recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json @@ -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]" diff --git a/recipe_modules/bot_update/example.py b/recipe_modules/bot_update/example.py index fd2c5fc99d..24bc89b908 100644 --- a/recipe_modules/bot_update/example.py +++ b/recipe_modules/bot_update/example.py @@ -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, ) diff --git a/recipe_modules/bot_update/resources/apply_gerrit.py b/recipe_modules/bot_update/resources/apply_gerrit.py index 7cfa20452d..5ef31d2284 100755 --- a/recipe_modules/bot_update/resources/apply_gerrit.py +++ b/recipe_modules/bot_update/resources/apply_gerrit.py @@ -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) ) diff --git a/recipe_modules/bot_update/resources/bot_update.py b/recipe_modules/bot_update/resources/bot_update.py index d53320413c..fe8dd66ffd 100755 --- a/recipe_modules/bot_update/resources/bot_update.py +++ b/recipe_modules/bot_update/resources/bot_update.py @@ -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,