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

Side by Side Diff: scripts/slave/recipes/run_presubmit.py

Issue 2224413002: Presubmit recipe: rebase Gerrit patches. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: add expectations 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 | scripts/slave/recipes/run_presubmit.expected/depot_tools_and_gerrit.json » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 DEPS = [ 5 DEPS = [
6 'depot_tools/bot_update', 6 'depot_tools/bot_update',
7 'depot_tools/gclient', 7 'depot_tools/gclient',
8 'depot_tools/git', 8 'depot_tools/git',
9 'depot_tools/presubmit', 9 'depot_tools/presubmit',
10 'recipe_engine/json', 10 'recipe_engine/json',
11 'recipe_engine/path', 11 'recipe_engine/path',
12 'recipe_engine/properties', 12 'recipe_engine/properties',
13 'recipe_engine/python', 13 'recipe_engine/python',
14 'recipe_engine/step', 14 'recipe_engine/step',
15 'depot_tools/tryserver', 15 'depot_tools/tryserver',
16 'depot_tools/rietveld', 16 'depot_tools/rietveld',
17 'v8', 17 'v8',
18 'webrtc', 18 'webrtc',
19 ] 19 ]
20 20
21 21
22 def _RunStepsInternal(api): 22 def _RunStepsInternal(api):
23 repo_name = api.properties['repo_name'] 23 repo_name = api.properties['repo_name']
24 codereview_auth = api.properties.get('codereview_auth', False) 24 codereview_auth = api.properties.get('codereview_auth', False)
25 force_checkout = api.properties.get('force_checkout', False) 25 force_checkout = api.properties.get('force_checkout', False)
26 patch_storage = api.properties.get('patch_storage', 'rietveld')
26 27
27 api.gclient.set_config(repo_name) 28 api.gclient.set_config(repo_name)
28 29
30 kwargs = {}
31 if patch_storage == 'gerrit':
32 kwargs['gerrit_rebase_patch_ref'] = True
29 bot_update_step = api.bot_update.ensure_checkout( 33 bot_update_step = api.bot_update.ensure_checkout(
30 force=force_checkout, 34 force=force_checkout,
31 patch_oauth2=codereview_auth) 35 patch_oauth2=codereview_auth,
36 **kwargs)
32 relative_root = api.gclient.calculate_patch_root( 37 relative_root = api.gclient.calculate_patch_root(
33 api.properties['patch_project']).rstrip('/') 38 api.properties['patch_project']).rstrip('/')
34 got_revision_property = api.gclient.c.got_revision_mapping[relative_root] 39 got_revision_property = api.gclient.c.got_revision_mapping[relative_root]
35 upstream = bot_update_step.json.output['properties'].get( 40 upstream = bot_update_step.json.output['properties'].get(
36 got_revision_property) 41 got_revision_property)
37 if (not upstream or 42 if (not upstream or
38 isinstance(upstream, int) or 43 isinstance(upstream, int) or
39 (upstream.isdigit() and len(upstream) < 40)): 44 (upstream.isdigit() and len(upstream) < 40)):
40 # If got_revision is an svn revision, then use got_revision_git. 45 # If got_revision is an svn revision, then use got_revision_git.
41 upstream = bot_update_step.json.output['properties'].get( 46 upstream = bot_update_step.json.output['properties'].get(
42 '%s_git' % got_revision_property) or '' 47 '%s_git' % got_revision_property) or ''
43 48
44 abs_root = api.path['slave_build'].join(relative_root) 49 abs_root = api.path['slave_build'].join(relative_root)
45 # TODO(hinoka): Extract email/name from issue? 50 # TODO(hinoka): Extract email/name from issue?
46 api.git('-c', 'user.email=commit-bot@chromium.org', 51 api.git('-c', 'user.email=commit-bot@chromium.org',
47 '-c', 'user.name=The Commit Bot', 52 '-c', 'user.name=The Commit Bot',
48 'commit', '-a', '-m', 'Committed patch', 53 'commit', '-a', '-m', 'Committed patch',
49 name='commit git patch', cwd=abs_root) 54 name='commit git patch', cwd=abs_root)
50 55
51 if api.properties.get('runhooks'): 56 if api.properties.get('runhooks'):
52 api.gclient.runhooks() 57 api.gclient.runhooks()
53 58
54 patch_storage = api.properties.get('patch_storage', 'rietveld')
55 if patch_storage == 'rietveld': 59 if patch_storage == 'rietveld':
56 presubmit_args = [ 60 presubmit_args = [
57 '--issue', api.properties['issue'], 61 '--issue', api.properties['issue'],
58 '--patchset', api.properties['patchset'], 62 '--patchset', api.properties['patchset'],
59 '--rietveld_url', api.properties['rietveld'], 63 '--rietveld_url', api.properties['rietveld'],
60 '--rietveld_fetch', 64 '--rietveld_fetch',
61 ] 65 ]
62 if codereview_auth: 66 if codereview_auth:
63 presubmit_args.extend([ 67 presubmit_args.extend([
64 '--rietveld_email_file', 68 '--rietveld_email_file',
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 234
231 yield ( 235 yield (
232 api.test('presubmit-infra-failure') + 236 api.test('presubmit-infra-failure') +
233 api.properties.tryserver( 237 api.properties.tryserver(
234 mastername='tryserver.chromium.linux', 238 mastername='tryserver.chromium.linux',
235 buildername='chromium_presubmit', 239 buildername='chromium_presubmit',
236 repo_name='chromium', 240 repo_name='chromium',
237 patch_project='chromium') + 241 patch_project='chromium') +
238 api.step_data('presubmit', api.json.output({}, retcode=2)) 242 api.step_data('presubmit', api.json.output({}, retcode=2))
239 ) 243 )
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipes/run_presubmit.expected/depot_tools_and_gerrit.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698