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

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

Issue 2249983004: Add apply_gerrit_ref to bot_update api (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: disable=relative-import Created 4 years, 4 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 kwargs.setdefault('env', {}) 46 kwargs.setdefault('env', {})
47 kwargs['env'].setdefault('PATH', '%(PATH)s') 47 kwargs['env'].setdefault('PATH', '%(PATH)s')
48 kwargs['env']['PATH'] = self.m.path.pathsep.join([ 48 kwargs['env']['PATH'] = self.m.path.pathsep.join([
49 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) 49 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)])
50 return self.m.python(name, bot_update_path, cmd, **kwargs) 50 return self.m.python(name, bot_update_path, cmd, **kwargs)
51 51
52 @property 52 @property
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 # DO NOT USE.
57 # The below method will be removed after there are no more callers of
58 # tryserver.maybe_apply_issue (skbug.com/5588).
59 def apply_gerrit_ref(self, root, gerrit_no_reset=False,
60 gerrit_rebase_patch_ref=True, **kwargs):
61 apply_gerrit_path = self.resource('apply_gerrit.py')
62 kwargs.setdefault('infra_step', True)
63 kwargs.setdefault('env', {}).setdefault('PATH', '%(PATH)s')
64 kwargs['env']['PATH'] = self.m.path.pathsep.join([
65 kwargs['env']['PATH'], str(self._module.PACKAGE_REPO_ROOT)])
66 cmd = [
67 '--gerrit_repo', self._repository,
68 '--gerrit_ref', self._gerrit_ref or '',
69 '--root', str(root),
70 ]
71 if gerrit_no_reset:
72 cmd.append('--gerrit_no_reset')
73 if gerrit_rebase_patch_ref:
74 cmd.append('--gerrit_rebase_patch_ref')
75 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs)
76
56 def ensure_checkout(self, gclient_config=None, suffix=None, 77 def ensure_checkout(self, gclient_config=None, suffix=None,
57 patch=True, update_presentation=True, 78 patch=True, update_presentation=True,
58 force=False, patch_root=None, no_shallow=False, 79 force=False, patch_root=None, no_shallow=False,
59 with_branch_heads=False, refs=None, 80 with_branch_heads=False, refs=None,
60 patch_oauth2=False, use_site_config_creds=True, 81 patch_oauth2=False, use_site_config_creds=True,
61 output_manifest=True, clobber=False, 82 output_manifest=True, clobber=False,
62 root_solution_revision=None, rietveld=None, issue=None, 83 root_solution_revision=None, rietveld=None, issue=None,
63 patchset=None, gerrit_no_reset=False, 84 patchset=None, gerrit_no_reset=False,
64 gerrit_rebase_patch_ref=False, **kwargs): 85 gerrit_rebase_patch_ref=False, **kwargs):
65 """ 86 """
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 314
294 # bot_update actually just sets root to be the folder name of the 315 # bot_update actually just sets root to be the folder name of the
295 # first solution. 316 # first solution.
296 if step_result.json.output['did_run']: 317 if step_result.json.output['did_run']:
297 co_root = step_result.json.output['root'] 318 co_root = step_result.json.output['root']
298 cwd = kwargs.get('cwd', self.m.path['slave_build']) 319 cwd = kwargs.get('cwd', self.m.path['slave_build'])
299 if 'checkout' not in self.m.path: 320 if 'checkout' not in self.m.path:
300 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) 321 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
301 322
302 return step_result 323 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