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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 def last_returned_properties(self): | 53 def last_returned_properties(self): |
54 return self._last_returned_properties | 54 return self._last_returned_properties |
55 | 55 |
56 def ensure_checkout(self, gclient_config=None, suffix=None, | 56 def ensure_checkout(self, gclient_config=None, suffix=None, |
57 patch=True, update_presentation=True, | 57 patch=True, update_presentation=True, |
58 force=False, patch_root=None, no_shallow=False, | 58 force=False, patch_root=None, no_shallow=False, |
59 with_branch_heads=False, refs=None, | 59 with_branch_heads=False, refs=None, |
60 patch_project_roots=None, patch_oauth2=False, | 60 patch_project_roots=None, patch_oauth2=False, |
61 output_manifest=True, clobber=False, | 61 output_manifest=True, clobber=False, |
62 root_solution_revision=None, rietveld=None, issue=None, | 62 root_solution_revision=None, rietveld=None, issue=None, |
63 patchset=None, **kwargs): | 63 patchset=None, gerrit_no_reset=False, **kwargs): |
64 """ | 64 """ |
65 Args: | 65 Args: |
66 gclient_config: The gclient configuration to use when running bot_update. | 66 gclient_config: The gclient configuration to use when running bot_update. |
67 If omitted, the current gclient configuration is used. | 67 If omitted, the current gclient configuration is used. |
68 rietveld: The rietveld server to use. If omitted, will infer from | 68 rietveld: The rietveld server to use. If omitted, will infer from |
69 the 'rietveld' property. | 69 the 'rietveld' property. |
70 issue: The rietveld issue number to use. If omitted, will infer from | 70 issue: The rietveld issue number to use. If omitted, will infer from |
71 the 'issue' property. | 71 the 'issue' property. |
72 patchset: The rietveld issue patchset to use. If omitted, will infer from | 72 patchset: The rietveld issue patchset to use. If omitted, will infer from |
73 the 'patchset' property. | 73 the 'patchset' property. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if clobber: | 193 if clobber: |
194 cmd.append('--clobber') | 194 cmd.append('--clobber') |
195 if force: | 195 if force: |
196 cmd.append('--force') | 196 cmd.append('--force') |
197 if no_shallow: | 197 if no_shallow: |
198 cmd.append('--no_shallow') | 198 cmd.append('--no_shallow') |
199 if output_manifest: | 199 if output_manifest: |
200 cmd.append('--output_manifest') | 200 cmd.append('--output_manifest') |
201 if with_branch_heads or cfg.with_branch_heads: | 201 if with_branch_heads or cfg.with_branch_heads: |
202 cmd.append('--with_branch_heads') | 202 cmd.append('--with_branch_heads') |
| 203 if gerrit_no_reset: |
| 204 cmd.append('--gerrit_no_reset') |
203 | 205 |
204 # Inject Json output for testing. | 206 # Inject Json output for testing. |
205 git_mode = self._mastername not in SVN_MASTERS | 207 git_mode = self._mastername not in SVN_MASTERS |
206 first_sln = cfg.solutions[0].name | 208 first_sln = cfg.solutions[0].name |
207 step_test_data = lambda: self.test_api.output_json( | 209 step_test_data = lambda: self.test_api.output_json( |
208 master, builder, slave, root, first_sln, rev_map, git_mode, force, | 210 master, builder, slave, root, first_sln, rev_map, git_mode, force, |
209 self._fail_patch, | 211 self._fail_patch, |
210 output_manifest=output_manifest, fixed_revisions=fixed_revisions) | 212 output_manifest=output_manifest, fixed_revisions=fixed_revisions) |
211 | 213 |
212 # Add suffixes to the step name, if specified. | 214 # Add suffixes to the step name, if specified. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 270 |
269 # bot_update actually just sets root to be the folder name of the | 271 # bot_update actually just sets root to be the folder name of the |
270 # first solution. | 272 # first solution. |
271 if step_result.json.output['did_run']: | 273 if step_result.json.output['did_run']: |
272 co_root = step_result.json.output['root'] | 274 co_root = step_result.json.output['root'] |
273 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 275 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
274 if 'checkout' not in self.m.path: | 276 if 'checkout' not in self.m.path: |
275 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 277 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
276 | 278 |
277 return step_result | 279 return step_result |
OLD | NEW |