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

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
« no previous file with comments | « no previous file | recipe_modules/bot_update/example.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_no_rebase_patch_ref=False,
53 gerrit_rebase_patch_ref=True, **kwargs): 54 gerrit_rebase_patch_ref=True, **kwargs):
54 apply_gerrit_path = self.resource('apply_gerrit.py') 55 apply_gerrit_path = self.resource('apply_gerrit.py')
55 kwargs.setdefault('infra_step', True) 56 kwargs.setdefault('infra_step', True)
56 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s') 57 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s')
57 kwargs['env']['PATH'] = self.m.path.pathsep.join([ 58 kwargs['env']['PATH'] = self.m.path.pathsep.join([
58 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) 59 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)])
59 cmd = [ 60 cmd = [
60 '--gerrit_repo', self._repository, 61 '--gerrit_repo', self._repository,
61 '--gerrit_ref', self._gerrit_ref or '', 62 '--gerrit_ref', self._gerrit_ref or '',
62 '--root', str(root), 63 '--root', str(root),
63 ] 64 ]
64 if gerrit_no_reset: 65 if gerrit_no_reset:
65 cmd.append('--gerrit_no_reset') 66 cmd.append('--gerrit_no_reset')
66 if gerrit_rebase_patch_ref: 67 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref:
67 cmd.append('--gerrit_rebase_patch_ref') 68 cmd.append('--gerrit_no_rebase_patch_ref')
68 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) 69 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs)
69 70
70 def ensure_checkout(self, gclient_config=None, suffix=None, 71 def ensure_checkout(self, gclient_config=None, suffix=None,
71 patch=True, update_presentation=True, 72 patch=True, update_presentation=True,
72 force=False, patch_root=None, no_shallow=False, 73 force=False, patch_root=None, no_shallow=False,
73 with_branch_heads=False, refs=None, 74 with_branch_heads=False, refs=None,
74 patch_oauth2=False, use_site_config_creds=True, 75 patch_oauth2=False, use_site_config_creds=True,
75 output_manifest=True, clobber=False, 76 output_manifest=True, clobber=False,
76 root_solution_revision=None, rietveld=None, issue=None, 77 root_solution_revision=None, rietveld=None, issue=None,
77 patchset=None, gerrit_no_reset=False, 78 patchset=None, gerrit_no_reset=False,
78 gerrit_rebase_patch_ref=False, **kwargs): 79 gerrit_no_rebase_patch_ref=False,
80 gerrit_rebase_patch_ref=True, **kwargs):
79 """ 81 """
80 Args: 82 Args:
81 use_site_config_creds: If the oauth2 credentials are in the buildbot 83 use_site_config_creds: If the oauth2 credentials are in the buildbot
82 site_config. See crbug.com/624212 for more information. 84 site_config. See crbug.com/624212 for more information.
83 gclient_config: The gclient configuration to use when running bot_update. 85 gclient_config: The gclient configuration to use when running bot_update.
84 If omitted, the current gclient configuration is used. 86 If omitted, the current gclient configuration is used.
85 rietveld: The rietveld server to use. If omitted, will infer from 87 rietveld: The rietveld server to use. If omitted, will infer from
86 the 'rietveld' property. 88 the 'rietveld' property.
87 issue: The rietveld issue number to use. If omitted, will infer from 89 issue: The rietveld issue number to use. If omitted, will infer from
88 the 'issue' property. 90 the 'issue' property.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if force: 226 if force:
225 cmd.append('--force') 227 cmd.append('--force')
226 if no_shallow: 228 if no_shallow:
227 cmd.append('--no_shallow') 229 cmd.append('--no_shallow')
228 if output_manifest: 230 if output_manifest:
229 cmd.append('--output_manifest') 231 cmd.append('--output_manifest')
230 if with_branch_heads or cfg.with_branch_heads: 232 if with_branch_heads or cfg.with_branch_heads:
231 cmd.append('--with_branch_heads') 233 cmd.append('--with_branch_heads')
232 if gerrit_no_reset: 234 if gerrit_no_reset:
233 cmd.append('--gerrit_no_reset') 235 cmd.append('--gerrit_no_reset')
234 if gerrit_rebase_patch_ref: 236 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref:
235 cmd.append('--gerrit_rebase_patch_ref') 237 cmd.append('--gerrit_no_rebase_patch_ref')
236 238
237 # Inject Json output for testing. 239 # Inject Json output for testing.
238 first_sln = cfg.solutions[0].name 240 first_sln = cfg.solutions[0].name
239 step_test_data = lambda: self.test_api.output_json( 241 step_test_data = lambda: self.test_api.output_json(
240 master, builder, slave, root, first_sln, rev_map, force, 242 master, builder, slave, root, first_sln, rev_map, force,
241 self._fail_patch, 243 self._fail_patch,
242 output_manifest=output_manifest, fixed_revisions=fixed_revisions) 244 output_manifest=output_manifest, fixed_revisions=fixed_revisions)
243 245
244 # Add suffixes to the step name, if specified. 246 # Add suffixes to the step name, if specified.
245 name = 'bot_update' 247 name = 'bot_update'
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 308
307 # bot_update actually just sets root to be the folder name of the 309 # bot_update actually just sets root to be the folder name of the
308 # first solution. 310 # first solution.
309 if step_result.json.output['did_run']: 311 if step_result.json.output['did_run']:
310 co_root = step_result.json.output['root'] 312 co_root = step_result.json.output['root']
311 cwd = kwargs.get('cwd', self.m.path['slave_build']) 313 cwd = kwargs.get('cwd', self.m.path['slave_build'])
312 if 'checkout' not in self.m.path: 314 if 'checkout' not in self.m.path:
313 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) 315 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
314 316
315 return step_result 317 return step_result
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/bot_update/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698