Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: recipe_modules/bot_update/api.py

Issue 2298883002: Make rebase and sync the default for Gerrit updates (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return self.m.python(name, bot_update_path, cmd, **kwargs) 43 return self.m.python(name, bot_update_path, cmd, **kwargs)
44 44
45 @property 45 @property
46 def last_returned_properties(self): 46 def last_returned_properties(self):
47 return self._last_returned_properties 47 return self._last_returned_properties
48 48
49 # DO NOT USE. 49 # DO NOT USE.
50 # The below method will be removed after there are no more callers of 50 # The below method will be removed after there are no more callers of
51 # tryserver.maybe_apply_issue (skbug.com/5588). 51 # tryserver.maybe_apply_issue (skbug.com/5588).
52 def apply_gerrit_ref(self, root, gerrit_no_reset=False, 52 def apply_gerrit_ref(self, root, gerrit_no_reset=False,
53 gerrit_rebase_patch_ref=True, **kwargs): 53 gerrit_no_rebase_patch_ref=False, **kwargs):
54 apply_gerrit_path = self.resource('apply_gerrit.py') 54 apply_gerrit_path = self.resource('apply_gerrit.py')
55 kwargs.setdefault('infra_step', True) 55 kwargs.setdefault('infra_step', True)
56 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s') 56 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s')
57 kwargs['env']['PATH'] = self.m.path.pathsep.join([ 57 kwargs['env']['PATH'] = self.m.path.pathsep.join([
58 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) 58 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)])
59 cmd = [ 59 cmd = [
60 '--gerrit_repo', self._repository, 60 '--gerrit_repo', self._repository,
61 '--gerrit_ref', self._gerrit_ref or '', 61 '--gerrit_ref', self._gerrit_ref or '',
62 '--root', str(root), 62 '--root', str(root),
63 ] 63 ]
64 if gerrit_no_reset: 64 if gerrit_no_reset:
65 cmd.append('--gerrit_no_reset') 65 cmd.append('--gerrit_no_reset')
66 if gerrit_rebase_patch_ref: 66 if gerrit_no_rebase_patch_ref:
67 cmd.append('--gerrit_rebase_patch_ref') 67 cmd.append('--gerrit_no_rebase_patch_ref')
68 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) 68 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs)
69 69
70 def ensure_checkout(self, gclient_config=None, suffix=None, 70 def ensure_checkout(self, gclient_config=None, suffix=None,
71 patch=True, update_presentation=True, 71 patch=True, update_presentation=True,
72 force=False, patch_root=None, no_shallow=False, 72 force=False, patch_root=None, no_shallow=False,
73 with_branch_heads=False, refs=None, 73 with_branch_heads=False, refs=None,
74 patch_oauth2=False, use_site_config_creds=True, 74 patch_oauth2=False, use_site_config_creds=True,
75 output_manifest=True, clobber=False, 75 output_manifest=True, clobber=False,
76 root_solution_revision=None, rietveld=None, issue=None, 76 root_solution_revision=None, rietveld=None, issue=None,
77 patchset=None, gerrit_no_reset=False, 77 patchset=None, gerrit_no_reset=False,
78 gerrit_rebase_patch_ref=False, **kwargs): 78 gerrit_no_rebase_patch_ref=False, **kwargs):
79 """ 79 """
80 Args: 80 Args:
81 use_site_config_creds: If the oauth2 credentials are in the buildbot 81 use_site_config_creds: If the oauth2 credentials are in the buildbot
82 site_config. See crbug.com/624212 for more information. 82 site_config. See crbug.com/624212 for more information.
83 gclient_config: The gclient configuration to use when running bot_update. 83 gclient_config: The gclient configuration to use when running bot_update.
84 If omitted, the current gclient configuration is used. 84 If omitted, the current gclient configuration is used.
85 rietveld: The rietveld server to use. If omitted, will infer from 85 rietveld: The rietveld server to use. If omitted, will infer from
86 the 'rietveld' property. 86 the 'rietveld' property.
87 issue: The rietveld issue number to use. If omitted, will infer from 87 issue: The rietveld issue number to use. If omitted, will infer from
88 the 'issue' property. 88 the 'issue' property.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if force: 224 if force:
225 cmd.append('--force') 225 cmd.append('--force')
226 if no_shallow: 226 if no_shallow:
227 cmd.append('--no_shallow') 227 cmd.append('--no_shallow')
228 if output_manifest: 228 if output_manifest:
229 cmd.append('--output_manifest') 229 cmd.append('--output_manifest')
230 if with_branch_heads or cfg.with_branch_heads: 230 if with_branch_heads or cfg.with_branch_heads:
231 cmd.append('--with_branch_heads') 231 cmd.append('--with_branch_heads')
232 if gerrit_no_reset: 232 if gerrit_no_reset:
233 cmd.append('--gerrit_no_reset') 233 cmd.append('--gerrit_no_reset')
234 if gerrit_rebase_patch_ref: 234 if gerrit_no_rebase_patch_ref:
235 cmd.append('--gerrit_rebase_patch_ref') 235 cmd.append('--gerrit_no_rebase_patch_ref')
236 236
237 # Inject Json output for testing. 237 # Inject Json output for testing.
238 first_sln = cfg.solutions[0].name 238 first_sln = cfg.solutions[0].name
239 step_test_data = lambda: self.test_api.output_json( 239 step_test_data = lambda: self.test_api.output_json(
240 master, builder, slave, root, first_sln, rev_map, force, 240 master, builder, slave, root, first_sln, rev_map, force,
241 self._fail_patch, 241 self._fail_patch,
242 output_manifest=output_manifest, fixed_revisions=fixed_revisions) 242 output_manifest=output_manifest, fixed_revisions=fixed_revisions)
243 243
244 # Add suffixes to the step name, if specified. 244 # Add suffixes to the step name, if specified.
245 name = 'bot_update' 245 name = 'bot_update'
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 # 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
308 # first solution. 308 # first solution.
309 if step_result.json.output['did_run']: 309 if step_result.json.output['did_run']:
310 co_root = step_result.json.output['root'] 310 co_root = step_result.json.output['root']
311 cwd = kwargs.get('cwd', self.m.path['slave_build']) 311 cwd = kwargs.get('cwd', self.m.path['slave_build'])
312 if 'checkout' not in self.m.path: 312 if 'checkout' not in self.m.path:
313 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))
314 314
315 return step_result 315 return step_result
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/bot_update/example.py » ('j') | recipe_modules/bot_update/example.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698