瀏覽代碼

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 <jbudorick@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
John Budorick 7 年之前
父節點
當前提交
7de5f08c45

+ 3 - 5
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.
 Wrapper for easy calling of bot_update.
 
 
-&mdash; **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):**
-
-&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#413)(self, bot_update_step):**
+&mdash; **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.
 Deapplies a patch, taking care of DEPS and solution revisions properly.
     
     
 
 
-&mdash; **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):**
+&mdash; **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:
 Args:
   gclient_config: The gclient configuration to use when running bot_update.
   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
   manifest_name: The name of the manifest to upload to LogDog.  This must
     be unique for the whole build.
     be unique for the whole build.
 
 
-&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#390)(self, project_name, gclient_config=None):**
+&mdash; **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
 Returns all property names used for storing the checked-out revision of
 a given project.
 a given project.

+ 3 - 29
recipes/recipe_modules/bot_update/api.py

@@ -47,30 +47,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
   def last_returned_properties(self):
   def last_returned_properties(self):
       return self._last_returned_properties
       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,
   def ensure_checkout(self, gclient_config=None, suffix=None,
                       patch=True, update_presentation=True,
                       patch=True, update_presentation=True,
                       patch_root=None,
                       patch_root=None,
@@ -138,15 +114,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
 
 
     # How to find the patch, if any
     # How to find the patch, if any
     if patch:
     if patch:
+      if self._repository and self._gerrit_ref:
+        flags.append(
+            ['--patch_ref', '%s@%s' % (self._repository, self._gerrit_ref)])
       if patch_refs:
       if patch_refs:
         flags.extend(
         flags.extend(
             ['--patch_ref', patch_ref]
             ['--patch_ref', patch_ref]
             for patch_ref in patch_refs)
             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.
     # Compute requested revisions.
     revisions = {}
     revisions = {}

+ 0 - 29
recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json

@@ -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
-  }
-]

+ 0 - 29
recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json

@@ -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
-  }
-]

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--revision",
       "--revision",

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--revision",
       "--revision",

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@refs/branch-heads/67",
       "src@refs/branch-heads/67",
       "--refs",
       "--refs",

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@experimental/feature",
       "src@experimental/feature",
       "--disable-syntax-validation"
       "--disable-syntax-validation"

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--revision",
       "--revision",

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--revision",
       "--revision",

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--disable-syntax-validation"
       "--disable-syntax-validation"

+ 2 - 4
recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json

@@ -60,10 +60,8 @@
       "[CLEANUP]/bot_update",
       "[CLEANUP]/bot_update",
       "--output_json",
       "--output_json",
       "/path/to/tmp/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",
       "--revision",
       "src@HEAD",
       "src@HEAD",
       "--revision",
       "--revision",

+ 15 - 47
recipes/recipe_modules/bot_update/examples/full.py

@@ -51,38 +51,21 @@ def RunSteps(api):
   manifest_name = api.properties.get('manifest_name')
   manifest_name = api.properties.get('manifest_name')
   patch_refs = api.properties.get('patch_refs')
   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):
 def GenTests(api):
@@ -160,21 +143,6 @@ def GenTests(api):
   yield api.test('gerrit_no_rebase_patch_ref') + api.properties(
   yield api.test('gerrit_no_rebase_patch_ref') + api.properties(
       gerrit_no_rebase_patch_ref=True
       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(
   yield api.test('tryjob_v8') + api.properties(
       issue=12345,
       issue=12345,
       patchset=654321,
       patchset=654321,

+ 0 - 33
recipes/recipe_modules/bot_update/resources/apply_gerrit.py

@@ -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)
-  )

+ 4 - 84
recipes/recipe_modules/bot_update/resources/bot_update.py

@@ -344,7 +344,7 @@ def git_config_if_not_set(key, value):
 
 
 def gclient_sync(
 def gclient_sync(
     with_branch_heads, with_tags, revisions, break_repo_locks,
     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):
     gerrit_rebase_patch_ref, apply_patch_on_gclient):
   # We just need to allocate a filename.
   # We just need to allocate a filename.
   fd, gclient_output_file = tempfile.mkstemp(suffix='.json')
   fd, gclient_output_file = tempfile.mkstemp(suffix='.json')
@@ -366,9 +366,6 @@ def gclient_sync(
       revision = 'origin/master'
       revision = 'origin/master'
     args.extend(['--revision', '%s@%s' % (name, revision)])
     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:
   if apply_patch_on_gclient and patch_refs:
     for patch_ref in patch_refs:
     for patch_ref in patch_refs:
       args.extend(['--patch-ref', patch_ref])
       args.extend(['--patch-ref', patch_ref])
@@ -438,7 +435,7 @@ def create_manifest_old():
 
 
 
 
 # TODO(hinoka): Include patch revision.
 # 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.
   """Return the JSONPB equivilent of the source manifest proto.
 
 
   The source manifest proto is defined here:
   The source manifest proto is defined here:
@@ -475,8 +472,6 @@ def create_manifest(gclient_output, patch_root, gerrit_ref):
           'revision': revision,
           'revision': revision,
         }
         }
       }
       }
-      if patch_root == directory:
-        dirs[directory]['git_checkout']['patch_fetch_ref'] = gerrit_ref
 
 
   manifest['directories'] = dirs
   manifest['directories'] = dirs
   return manifest
   return manifest
@@ -759,58 +754,6 @@ def _download(url):
         raise
         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'):
 def get_commit_position(git_path, revision='HEAD'):
   """Dumps the 'git' log for a specific revision and parses out the commit
   """Dumps the 'git' log for a specific revision and parses out the commit
   position.
   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,
 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,
                     gerrit_rebase_patch_ref, refs, git_cache_dir,
                     cleanup_dir, gerrit_reset, disable_syntax_validation,
                     cleanup_dir, gerrit_reset, disable_syntax_validation,
                     apply_patch_on_gclient):
                     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:]
         relative_root = solution['name'][len(patch_root) + 1:]
         target = '/'.join([relative_root, 'DEPS']).lstrip('/')
         target = '/'.join([relative_root, 'DEPS']).lstrip('/')
         print '  relative root is %r, target is %r' % (relative_root, target)
         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.
   # Ensure our build/ directory is set up with the correct .gclient file.
   gclient_configure(solutions, target_os, target_os_only, target_cpu,
   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,
           break_repo_locks,
           disable_syntax_validation,
           disable_syntax_validation,
           patch_refs,
           patch_refs,
-          gerrit_repo,
-          gerrit_ref,
           gerrit_reset,
           gerrit_reset,
           gerrit_rebase_patch_ref,
           gerrit_rebase_patch_ref,
           apply_patch_on_gclient)
           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():
   if git('ls-files', '.DEPS.git', cwd=first_sln).strip():
     git('checkout', 'HEAD', '--', '.DEPS.git', cwd=first_sln)
     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.
   # Reset the deps_file point in the solutions so that hooks get run properly.
   for sln in solutions:
   for sln in solutions:
     sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS')
     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_root', help='Directory to patch on top of.')
   parse.add_option('--patch_ref', dest='patch_refs', action='append', default=[],
   parse.add_option('--patch_ref', dest='patch_refs', action='append', default=[],
                    help='Git repository & ref to apply, as REPO@REF.')
                    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',
   parse.add_option('--gerrit_no_rebase_patch_ref', action='store_true',
                    help='Bypass rebase of Gerrit patch ref after checkout.')
                    help='Bypass rebase of Gerrit patch ref after checkout.')
   parse.add_option('--gerrit_no_reset', action='store_true',
   parse.add_option('--gerrit_no_reset', action='store_true',
@@ -1088,10 +1014,6 @@ def parse_args():
     )
     )
 
 
   if options.patch_refs:
   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:
     if not options.apply_patch_on_gclient:
       parse.error('--patch_ref cannot be used with --no-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.
           # Then, pass in information about how to patch.
           patch_root=options.patch_root,
           patch_root=options.patch_root,
           patch_refs=options.patch_refs,
           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,
           gerrit_rebase_patch_ref=not options.gerrit_no_rebase_patch_ref,
 
 
           # Finally, extra configurations cleanup dir location.
           # Finally, extra configurations cleanup dir location.
@@ -1217,7 +1137,7 @@ def checkout(options, git_slns, specs, revisions, step_text):
             properties=got_revisions,
             properties=got_revisions,
             manifest=create_manifest_old(),
             manifest=create_manifest_old(),
             source_manifest=create_manifest(
             source_manifest=create_manifest(
-                gclient_output, options.patch_root, options.gerrit_ref))
+                gclient_output, options.patch_root))
 
 
 
 
 def print_debug_info():
 def print_debug_info():

+ 6 - 9
tests/bot_update_coverage_test.py

@@ -150,8 +150,6 @@ class BotUpdateUnittests(unittest.TestCase):
       'target_cpu': None,
       'target_cpu': None,
       'patch_root': None,
       'patch_root': None,
       'patch_refs': [],
       'patch_refs': [],
-      'gerrit_repo': None,
-      'gerrit_ref': None,
       'gerrit_rebase_patch_ref': None,
       'gerrit_rebase_patch_ref': None,
       'refs': [],
       'refs': [],
       'git_cache_dir': '',
       'git_cache_dir': '',
@@ -212,19 +210,18 @@ class BotUpdateUnittests(unittest.TestCase):
     return self.call.records
     return self.call.records
 
 
   def testEnableGclientExperiment(self):
   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
     self.params['apply_patch_on_gclient'] = True
     bot_update.ensure_checkout(**self.params)
     bot_update.ensure_checkout(**self.params)
     args = self.gclient.records[0]
     args = self.gclient.records[0]
     idx = args.index('--patch-ref')
     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:])
     self.assertNotIn('--patch-ref', args[idx+1:])
     # Assert we're not patching in bot_update.py
     # Assert we're not patching in bot_update.py
     for record in self.call.records:
     for record in self.call.records:
-      self.assertNotIn('git fetch ' + self.params['gerrit_repo'],
+      self.assertNotIn('git fetch ' + repo,
                        ' '.join(record[0]))
                        ' '.join(record[0]))
 
 
   def testPatchRefs(self):
   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(len(out['directories']), 2)
     self.assertEquals(
     self.assertEquals(
         out['directories']['src']['git_checkout']['revision'],
         out['directories']['src']['git_checkout']['revision'],