From 7de5f08c459c9d66880cacb1253961009d7feee3 Mon Sep 17 00:00:00 2001 From: John Budorick Date: Fri, 17 Aug 2018 16:42:51 +0000 Subject: [PATCH] bot_update: remove --gerrit_repo and --gerrit_ref. Bug: 865882 Recipe-Nontrivial-Roll: build Recipe-Nontrivial-Roll: build_limited_scripts_slave Recipe-Nontrivial-Roll: infra Recipe-Nontrivial-Roll: release_scripts Recipe-Nontrivial-Roll: skia Recipe-Nontrivial-Roll: skiabuildbot Change-Id: I4a04c4c28c7dc63ad282f54604c300bbfe654f11 Reviewed-on: https://chromium-review.googlesource.com/1157687 Commit-Queue: John Budorick Reviewed-by: Robbie Iannucci Reviewed-by: Andrii Shyshkalov --- recipes/README.recipes.md | 8 +- recipes/recipe_modules/bot_update/api.py | 32 +------ .../full.expected/apply_gerrit_ref.json | 29 ------ .../apply_gerrit_ref_custom.json | 29 ------ .../no_apply_patch_on_gclient.json | 6 +- .../full.expected/tryjob_gerrit_angle.json | 6 +- .../tryjob_gerrit_branch_heads.json | 6 +- .../tryjob_gerrit_feature_branch.json | 6 +- .../full.expected/tryjob_gerrit_v8.json | 6 +- .../tryjob_gerrit_v8_feature_branch.json | 6 +- .../full.expected/tryjob_gerrit_webrtc.json | 6 +- .../tryjob_v8_head_by_default.json | 6 +- .../bot_update/examples/full.py | 62 ++++--------- .../bot_update/resources/apply_gerrit.py | 33 ------- .../bot_update/resources/bot_update.py | 88 +------------------ tests/bot_update_coverage_test.py | 15 ++-- 16 files changed, 47 insertions(+), 297 deletions(-) delete mode 100644 recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json delete mode 100644 recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json delete mode 100755 recipes/recipe_modules/bot_update/resources/apply_gerrit.py diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 44386fbcf..5fbe165d7 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -51,14 +51,12 @@ Recipe module to ensure a checkout is consistent on a bot. Wrapper for easy calling of bot_update. -— **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#52)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, step_name='apply_gerrit', \*\*kwargs):** - -— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#413)(self, bot_update_step):** +— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#387)(self, bot_update_step):** Deapplies a patch, taking care of DEPS and solution revisions properly. -— **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#74)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=None, oauth2_json=None, use_site_config_creds=None, 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, manifest_name=None, patch_refs=None, \*\*kwargs):** +— **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#50)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=None, oauth2_json=None, use_site_config_creds=None, 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, manifest_name=None, patch_refs=None, \*\*kwargs):** Args: gclient_config: The gclient configuration to use when running bot_update. @@ -69,7 +67,7 @@ Args: manifest_name: The name of the manifest to upload to LogDog. This must be unique for the whole build. -— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#390)(self, project_name, gclient_config=None):** +— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#364)(self, project_name, gclient_config=None):** Returns all property names used for storing the checked-out revision of a given project. diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index 6675d1271..23b2a7e09 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -47,30 +47,6 @@ class BotUpdateApi(recipe_api.RecipeApi): def last_returned_properties(self): return self._last_returned_properties - # 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, - gerrit_repo=None, gerrit_ref=None, - step_name='apply_gerrit', **kwargs): - apply_gerrit_path = self.resource('apply_gerrit.py') - kwargs.setdefault('infra_step', True) - cmd = [ - '--gerrit_repo', gerrit_repo or self._repository, - '--gerrit_ref', gerrit_ref or self._gerrit_ref or '', - '--root', str(root), - ] - if gerrit_no_reset: - cmd.append('--gerrit_no_reset') - if gerrit_no_rebase_patch_ref: - cmd.append('--gerrit_no_rebase_patch_ref') - - env_prefixes = { - 'PATH': [self.m.depot_tools.root], - } - with self.m.context(env_prefixes=env_prefixes): - return self.m.python(step_name, apply_gerrit_path, cmd, **kwargs) - def ensure_checkout(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, @@ -138,15 +114,13 @@ class BotUpdateApi(recipe_api.RecipeApi): # How to find the patch, if any if patch: + if self._repository and self._gerrit_ref: + flags.append( + ['--patch_ref', '%s@%s' % (self._repository, self._gerrit_ref)]) if patch_refs: flags.extend( ['--patch_ref', patch_ref] for patch_ref in patch_refs) - elif self._repository and self._gerrit_ref: - flags.extend([ - ['--gerrit_repo', self._repository], - ['--gerrit_ref', self._gerrit_ref], - ]) # Compute requested revisions. revisions = {} diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json b/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json deleted file mode 100644 index f35693ff7..000000000 --- a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[depot_tools::bot_update]/resources/apply_gerrit.py", - "--gerrit_repo", - "chromium", - "--gerrit_ref", - "", - "--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 diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json b/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json deleted file mode 100644 index 25625d928..000000000 --- a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "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": "Custom apply gerrit step" - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -] \ No newline at end of file diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json index af3fb4ca8..02056cd01 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/angle/angle", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/angle/angle@refs/changes/11/338811/3", "--revision", "src@HEAD", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json index a89fce7b7..b060d5e6d 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/angle/angle", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/angle/angle@refs/changes/11/338811/3", "--revision", "src@HEAD", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json index 8059a343b..a7907f683 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/chromium/src", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/chromium/src@refs/changes/11/338811/3", "--revision", "src@refs/branch-heads/67", "--refs", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json index 0303d97da..cc8fd07a1 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/chromium/src", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/chromium/src@refs/changes/11/338811/3", "--revision", "src@experimental/feature", "--disable-syntax-validation" diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json index dab06b8c6..69dac547a 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/v8/v8", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/v8/v8@refs/changes/11/338811/3", "--revision", "src@HEAD", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json index 9d12f01fc..6b76ed12c 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/v8/v8", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://chromium.googlesource.com/v8/v8@refs/changes/11/338811/3", "--revision", "src@HEAD", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json index fbafe1997..714458fb7 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://webrtc.googlesource.com/src", - "--gerrit_ref", - "refs/changes/11/338811/3", + "--patch_ref", + "https://webrtc.googlesource.com/src@refs/changes/11/338811/3", "--revision", "src@HEAD", "--disable-syntax-validation" diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json index 0a8fdde73..95ea1d396 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json @@ -60,10 +60,8 @@ "[CLEANUP]/bot_update", "--output_json", "/path/to/tmp/json", - "--gerrit_repo", - "https://chromium.googlesource.com/chromium/src", - "--gerrit_ref", - "refs/changes/89/456789/12", + "--patch_ref", + "https://chromium.googlesource.com/chromium/src@refs/changes/89/456789/12", "--revision", "src@HEAD", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.py b/recipes/recipe_modules/bot_update/examples/full.py index 8cdb92d53..536206118 100644 --- a/recipes/recipe_modules/bot_update/examples/full.py +++ b/recipes/recipe_modules/bot_update/examples/full.py @@ -51,38 +51,21 @@ def RunSteps(api): manifest_name = api.properties.get('manifest_name') patch_refs = api.properties.get('patch_refs') - if api.properties.get('test_apply_gerrit_ref'): - prop2arg = { - 'gerrit_custom_repo': 'gerrit_repo', - 'gerrit_custom_ref': 'gerrit_ref', - 'gerrit_custom_step_name': 'step_name', - } - kwargs = { - prop2arg[p]: api.properties.get(p) - for p in prop2arg if api.properties.get(p) - } - 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, - **kwargs - ) - else: - bot_update_step = api.bot_update.ensure_checkout( - patch=patch, - with_branch_heads=with_branch_heads, - with_tags=with_tags, - refs=refs, - clobber=clobber, - root_solution_revision=root_solution_revision, - suffix=suffix, - gerrit_no_reset=gerrit_no_reset, - gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref, - disable_syntax_validation=True, - manifest_name=manifest_name, - patch_refs=patch_refs) - if patch: - api.bot_update.deapply_patch(bot_update_step) + bot_update_step = api.bot_update.ensure_checkout( + patch=patch, + with_branch_heads=with_branch_heads, + with_tags=with_tags, + refs=refs, + clobber=clobber, + root_solution_revision=root_solution_revision, + suffix=suffix, + gerrit_no_reset=gerrit_no_reset, + gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref, + disable_syntax_validation=True, + manifest_name=manifest_name, + patch_refs=patch_refs) + if patch: + api.bot_update.deapply_patch(bot_update_step) def GenTests(api): @@ -160,21 +143,6 @@ def GenTests(api): yield api.test('gerrit_no_rebase_patch_ref') + api.properties( gerrit_no_rebase_patch_ref=True ) - yield api.test('apply_gerrit_ref') + api.properties( - repository='chromium', - gerrit_no_rebase_patch_ref=True, - 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', - gerrit_custom_step_name='Custom apply gerrit step', - test_apply_gerrit_ref=True, - ) yield api.test('tryjob_v8') + api.properties( issue=12345, patchset=654321, diff --git a/recipes/recipe_modules/bot_update/resources/apply_gerrit.py b/recipes/recipe_modules/bot_update/resources/apply_gerrit.py deleted file mode 100755 index 5ef31d228..000000000 --- a/recipes/recipe_modules/bot_update/resources/apply_gerrit.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import optparse -import sys - -import bot_update # pylint: disable=relative-import - - -if __name__ == '__main__': - parse = optparse.OptionParser() - - 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('--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_no_rebase_patch_ref', action='store_true', - help='Bypass rebase of Gerrit patch ref after checkout.') - - options, _ = parse.parse_args() - - sys.exit( - bot_update.apply_gerrit_ref( - options.gerrit_repo, - options.gerrit_ref, - options.root, - not options.gerrit_no_reset, - not options.gerrit_no_rebase_patch_ref) - ) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index a9a610c53..4dffdd891 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -344,7 +344,7 @@ def git_config_if_not_set(key, value): def gclient_sync( with_branch_heads, with_tags, revisions, break_repo_locks, - disable_syntax_validation, patch_refs, gerrit_repo, gerrit_ref, gerrit_reset, + disable_syntax_validation, patch_refs, gerrit_reset, gerrit_rebase_patch_ref, apply_patch_on_gclient): # We just need to allocate a filename. fd, gclient_output_file = tempfile.mkstemp(suffix='.json') @@ -366,9 +366,6 @@ def gclient_sync( revision = 'origin/master' args.extend(['--revision', '%s@%s' % (name, revision)]) - if not patch_refs and gerrit_repo and gerrit_ref: - patch_refs = ['%s@%s' % (gerrit_repo, gerrit_ref)] - if apply_patch_on_gclient and patch_refs: for patch_ref in patch_refs: args.extend(['--patch-ref', patch_ref]) @@ -438,7 +435,7 @@ def create_manifest_old(): # TODO(hinoka): Include patch revision. -def create_manifest(gclient_output, patch_root, gerrit_ref): +def create_manifest(gclient_output, patch_root): """Return the JSONPB equivilent of the source manifest proto. The source manifest proto is defined here: @@ -475,8 +472,6 @@ def create_manifest(gclient_output, patch_root, gerrit_ref): 'revision': revision, } } - if patch_root == directory: - dirs[directory]['git_checkout']['patch_fetch_ref'] = gerrit_ref manifest['directories'] = dirs return manifest @@ -759,58 +754,6 @@ def _download(url): raise -def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset, - gerrit_rebase_patch_ref): - gerrit_repo = gerrit_repo or 'origin' - assert gerrit_ref - base_rev = git('rev-parse', 'HEAD', cwd=root).strip() - - print '===Applying gerrit ref===' - print 'Repo is %r @ %r, ref is %r, root is %r' % ( - gerrit_repo, base_rev, gerrit_ref, root) - # TODO(tandrii): move the fix below to common gerrit codepath. - # Speculative fix: prior bot_update run with Rietveld patch may leave git - # index with unmerged paths. bot_update calls 'checkout --force xyz' thus - # ignoring such paths, but potentially never cleaning them up. The following - # command will do so. See http://crbug.com/692067. - git('reset', '--hard', cwd=root) - try: - git('fetch', gerrit_repo, gerrit_ref, cwd=root) - git('checkout', 'FETCH_HEAD', cwd=root) - - if gerrit_rebase_patch_ref: - print '===Rebasing===' - # git rebase requires a branch to operate on. - temp_branch_name = 'tmp/' + uuid.uuid4().hex - try: - ok = False - git('checkout', '-b', temp_branch_name, cwd=root) - try: - git('-c', 'user.name=chrome-bot', - '-c', 'user.email=chrome-bot@chromium.org', - 'rebase', base_rev, cwd=root) - except SubprocessFailed: - # Abort the rebase since there were failures. - git('rebase', '--abort', cwd=root) - raise - - # Get off of the temporary branch since it can't be deleted otherwise. - cur_rev = git('rev-parse', 'HEAD', cwd=root).strip() - git('checkout', cur_rev, cwd=root) - git('branch', '-D', temp_branch_name, cwd=root) - ok = True - finally: - if not ok: - # Get off of the temporary branch since it can't be deleted otherwise. - git('checkout', base_rev, cwd=root) - git('branch', '-D', temp_branch_name, cwd=root) - - if gerrit_reset: - git('reset', '--soft', base_rev, cwd=root) - except SubprocessFailed as e: - raise PatchFailed(e.message, e.code, e.output) - - def get_commit_position(git_path, revision='HEAD'): """Dumps the 'git' log for a specific revision and parses out the commit position. @@ -870,7 +813,7 @@ def emit_json(out_file, did_run, gclient_output=None, **kwargs): def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only, - target_cpu, patch_root, patch_refs, gerrit_repo, gerrit_ref, + target_cpu, patch_root, patch_refs, gerrit_rebase_patch_ref, refs, git_cache_dir, cleanup_dir, gerrit_reset, disable_syntax_validation, apply_patch_on_gclient): @@ -893,10 +836,6 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only, relative_root = solution['name'][len(patch_root) + 1:] target = '/'.join([relative_root, 'DEPS']).lstrip('/') print ' relative root is %r, target is %r' % (relative_root, target) - if gerrit_ref: - apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset, - gerrit_rebase_patch_ref) - applied_gerrit_patch = True # Ensure our build/ directory is set up with the correct .gclient file. gclient_configure(solutions, target_os, target_os_only, target_cpu, @@ -928,8 +867,6 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only, break_repo_locks, disable_syntax_validation, patch_refs, - gerrit_repo, - gerrit_ref, gerrit_reset, gerrit_rebase_patch_ref, apply_patch_on_gclient) @@ -939,14 +876,6 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only, if git('ls-files', '.DEPS.git', cwd=first_sln).strip(): git('checkout', 'HEAD', '--', '.DEPS.git', cwd=first_sln) - # Apply the rest of the patch here (sans DEPS) - if gerrit_ref and not applied_gerrit_patch and not apply_patch_on_gclient: - # If gerrit_ref was for solution's main repository, it has already been - # applied above. This chunk is executed only for patches to DEPS-ed in - # git repositories. - apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset, - gerrit_rebase_patch_ref) - # Reset the deps_file point in the solutions so that hooks get run properly. for sln in solutions: sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') @@ -1005,9 +934,6 @@ def parse_args(): parse.add_option('--patch_root', help='Directory to patch on top of.') parse.add_option('--patch_ref', dest='patch_refs', action='append', default=[], help='Git repository & ref to apply, as REPO@REF.') - parse.add_option('--gerrit_repo', - help='Git repository to pull the ref from.') - parse.add_option('--gerrit_ref', help='Git ref to apply.') 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', @@ -1088,10 +1014,6 @@ def parse_args(): ) if options.patch_refs: - if options.gerrit_repo or options.gerrit_ref: - parse.error('Using --patch_ref with --gerrit_repo or --gerrit_ref ' - + 'is not supported.') - if not options.apply_patch_on_gclient: parse.error('--patch_ref cannot be used with --no-apply-patch-on-gclient') @@ -1158,8 +1080,6 @@ def checkout(options, git_slns, specs, revisions, step_text): # Then, pass in information about how to patch. patch_root=options.patch_root, patch_refs=options.patch_refs, - gerrit_repo=options.gerrit_repo, - gerrit_ref=options.gerrit_ref, gerrit_rebase_patch_ref=not options.gerrit_no_rebase_patch_ref, # Finally, extra configurations cleanup dir location. @@ -1217,7 +1137,7 @@ def checkout(options, git_slns, specs, revisions, step_text): properties=got_revisions, manifest=create_manifest_old(), source_manifest=create_manifest( - gclient_output, options.patch_root, options.gerrit_ref)) + gclient_output, options.patch_root)) def print_debug_info(): diff --git a/tests/bot_update_coverage_test.py b/tests/bot_update_coverage_test.py index 75ecffa10..d0778344d 100755 --- a/tests/bot_update_coverage_test.py +++ b/tests/bot_update_coverage_test.py @@ -150,8 +150,6 @@ class BotUpdateUnittests(unittest.TestCase): 'target_cpu': None, 'patch_root': None, 'patch_refs': [], - 'gerrit_repo': None, - 'gerrit_ref': None, 'gerrit_rebase_patch_ref': None, 'refs': [], 'git_cache_dir': '', @@ -212,19 +210,18 @@ class BotUpdateUnittests(unittest.TestCase): return self.call.records def testEnableGclientExperiment(self): - self.params['gerrit_ref'] = 'refs/changes/12/345/6' - self.params['gerrit_repo'] = 'https://chromium.googlesource.com/v8/v8' + ref = 'refs/changes/12/345/6' + repo = 'https://chromium.googlesource.com/v8/v8' + self.params['patch_refs'] = ['%s@%s' % (repo, ref)] self.params['apply_patch_on_gclient'] = True bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx = args.index('--patch-ref') - self.assertEqual( - args[idx+1], - self.params['gerrit_repo'] + '@' + self.params['gerrit_ref']) + self.assertEqual(args[idx+1], self.params['patch_refs'][0]) self.assertNotIn('--patch-ref', args[idx+1:]) # Assert we're not patching in bot_update.py for record in self.call.records: - self.assertNotIn('git fetch ' + self.params['gerrit_repo'], + self.assertNotIn('git fetch ' + repo, ' '.join(record[0])) def testPatchRefs(self): @@ -285,7 +282,7 @@ class BotUpdateUnittests(unittest.TestCase): }, } } - out = bot_update.create_manifest(gclient_output, None, None) + out = bot_update.create_manifest(gclient_output, None) self.assertEquals(len(out['directories']), 2) self.assertEquals( out['directories']['src']['git_checkout']['revision'],