| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Recipe module to ensure a checkout is consistant on a bot.""" | 6 """Recipe module to ensure a checkout is consistant on a bot.""" |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| 11 # This is just for testing, to indicate if a master is using a Git scheduler | |
| 12 # or not. | |
| 13 SVN_MASTERS = ( | |
| 14 'experimental.svn', | |
| 15 ) | |
| 16 | |
| 17 | |
| 18 class BotUpdateApi(recipe_api.RecipeApi): | 11 class BotUpdateApi(recipe_api.RecipeApi): |
| 19 | 12 |
| 20 def __init__(self, mastername, buildername, slavename, issue, patchset, | 13 def __init__(self, mastername, buildername, slavename, issue, patchset, |
| 21 patch_url, repository, gerrit_ref, rietveld, revision, | 14 patch_url, repository, gerrit_ref, rietveld, revision, |
| 22 parent_got_revision, deps_revision_overrides, fail_patch, | 15 parent_got_revision, deps_revision_overrides, fail_patch, |
| 23 *args, **kwargs): | 16 *args, **kwargs): |
| 24 self._mastername = mastername | 17 self._mastername = mastername |
| 25 self._buildername = buildername | 18 self._buildername = buildername |
| 26 self._slavename = slavename | 19 self._slavename = slavename |
| 27 self._issue = issue | 20 self._issue = issue |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if output_manifest: | 228 if output_manifest: |
| 236 cmd.append('--output_manifest') | 229 cmd.append('--output_manifest') |
| 237 if with_branch_heads or cfg.with_branch_heads: | 230 if with_branch_heads or cfg.with_branch_heads: |
| 238 cmd.append('--with_branch_heads') | 231 cmd.append('--with_branch_heads') |
| 239 if gerrit_no_reset: | 232 if gerrit_no_reset: |
| 240 cmd.append('--gerrit_no_reset') | 233 cmd.append('--gerrit_no_reset') |
| 241 if gerrit_rebase_patch_ref: | 234 if gerrit_rebase_patch_ref: |
| 242 cmd.append('--gerrit_rebase_patch_ref') | 235 cmd.append('--gerrit_rebase_patch_ref') |
| 243 | 236 |
| 244 # Inject Json output for testing. | 237 # Inject Json output for testing. |
| 245 git_mode = self._mastername not in SVN_MASTERS | |
| 246 first_sln = cfg.solutions[0].name | 238 first_sln = cfg.solutions[0].name |
| 247 step_test_data = lambda: self.test_api.output_json( | 239 step_test_data = lambda: self.test_api.output_json( |
| 248 master, builder, slave, root, first_sln, rev_map, git_mode, force, | 240 master, builder, slave, root, first_sln, rev_map, force, |
| 249 self._fail_patch, | 241 self._fail_patch, |
| 250 output_manifest=output_manifest, fixed_revisions=fixed_revisions) | 242 output_manifest=output_manifest, fixed_revisions=fixed_revisions) |
| 251 | 243 |
| 252 # Add suffixes to the step name, if specified. | 244 # Add suffixes to the step name, if specified. |
| 253 name = 'bot_update' | 245 name = 'bot_update' |
| 254 if not patch: | 246 if not patch: |
| 255 name += ' (without patch)' | 247 name += ' (without patch)' |
| 256 if suffix: | 248 if suffix: |
| 257 name += ' - %s' % suffix | 249 name += ' - %s' % suffix |
| 258 | 250 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 306 |
| 315 # bot_update actually just sets root to be the folder name of the | 307 # bot_update actually just sets root to be the folder name of the |
| 316 # first solution. | 308 # first solution. |
| 317 if step_result.json.output['did_run']: | 309 if step_result.json.output['did_run']: |
| 318 co_root = step_result.json.output['root'] | 310 co_root = step_result.json.output['root'] |
| 319 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 311 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
| 320 if 'checkout' not in self.m.path: | 312 if 'checkout' not in self.m.path: |
| 321 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 313 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
| 322 | 314 |
| 323 return step_result | 315 return step_result |
| OLD | NEW |