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

Side by Side Diff: recipe_modules/git/example.py

Issue 1642023002: depot_tools: import bot_update gclient git rietveld tryserver recipe modules (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: presubmit Created 4 years, 10 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 | « recipe_modules/git/api.py ('k') | recipe_modules/git/example.expected/basic.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 DEPS = [
6 'git',
7 'recipe_engine/path',
8 'recipe_engine/platform',
9 'recipe_engine/properties',
10 'recipe_engine/raw_io',
11 'recipe_engine/step',
12 ]
13
14
15 def RunSteps(api):
16 url = 'https://chromium.googlesource.com/chromium/src.git'
17
18 # git.checkout can optionally dump GIT_CURL_VERBOSE traces to a log file,
19 # useful for debugging git access issues that are reproducible only on bots.
20 curl_trace_file = None
21 if api.properties.get('use_curl_trace'):
22 curl_trace_file = api.path['slave_build'].join('curl_trace.log')
23
24 submodule_update_force = api.properties.get('submodule_update_force', False)
25 submodule_update_recursive = api.properties.get('submodule_update_recursive',
26 True)
27
28 # You can use api.git.checkout to perform all the steps of a safe checkout.
29 api.git.checkout(
30 url,
31 ref=api.properties.get('revision'),
32 recursive=True,
33 submodule_update_force=submodule_update_force,
34 set_got_revision=api.properties.get('set_got_revision'),
35 curl_trace_file=curl_trace_file,
36 remote_name=api.properties.get('remote_name'),
37 display_fetch_size=api.properties.get('display_fetch_size'),
38 file_name=api.properties.get('checkout_file_name'),
39 submodule_update_recursive=submodule_update_recursive)
40
41 # count_objects shows number and size of objects in .git dir.
42 api.git.count_objects(
43 name='count-objects',
44 can_fail_build=api.properties.get('count_objects_can_fail_build'),
45 git_config_options={'foo': 'bar'})
46
47 # Get the remote URL.
48 api.git.get_remote_url(
49 step_test_data=lambda: api.raw_io.test_api.stream_output('foo'))
50
51 api.git.get_timestamp(test_data='foo')
52
53 # You can use api.git.fetch_tags to fetch all tags from the remote
54 api.git.fetch_tags(api.properties.get('remote_name'))
55
56 # If you need to run more arbitrary git commands, you can use api.git itself,
57 # which behaves like api.step(), but automatically sets the name of the step.
58 api.git('status', cwd=api.path['checkout'])
59
60 api.git('status', name='git status can_fail_build',
61 can_fail_build=True)
62
63 api.git('status', name='git status cannot_fail_build',
64 can_fail_build=False)
65
66 # You can use api.git.rebase to rebase the current branch onto another one
67 api.git.rebase(name_prefix='my repo', branch='origin/master',
68 dir_path=api.path['checkout'],
69 remote_name=api.properties.get('remote_name'))
70
71 if api.properties.get('cat_file', None):
72 step_result = api.git.cat_file_at_commit(api.properties['cat_file'],
73 api.properties['revision'],
74 stdout=api.raw_io.output())
75 if 'TestOutput' in step_result.stdout:
76 pass # Success!
77
78 # Bundle the repository.
79 api.git.bundle_create(
80 api.path['slave_build'].join('all.bundle'))
81
82
83 def GenTests(api):
84 yield api.test('basic')
85 yield api.test('basic_ref') + api.properties(revision='refs/foo/bar')
86 yield api.test('basic_branch') + api.properties(revision='refs/heads/testing')
87 yield api.test('basic_hash') + api.properties(
88 revision='abcdef0123456789abcdef0123456789abcdef01')
89 yield api.test('basic_file_name') + api.properties(checkout_file_name='DEPS')
90 yield api.test('basic_submodule_update_force') + api.properties(
91 submodule_update_force=True)
92
93 yield api.test('platform_win') + api.platform.name('win')
94
95 yield api.test('curl_trace_file') + api.properties(
96 revision='refs/foo/bar', use_curl_trace=True)
97
98 yield (
99 api.test('can_fail_build') +
100 api.step_data('git status can_fail_build', retcode=1)
101 )
102
103 yield (
104 api.test('cannot_fail_build') +
105 api.step_data('git status cannot_fail_build', retcode=1)
106 )
107
108 yield (
109 api.test('set_got_revision') +
110 api.properties(set_got_revision=True) +
111 api.step_data('set got_revision',
112 stdout=api.raw_io.output('deadbeef'))
113 )
114
115 yield (
116 api.test('rebase_failed') +
117 api.step_data('my repo rebase', retcode=1)
118 )
119
120 yield api.test('remote_not_origin') + api.properties(remote_name='not_origin')
121
122 yield (
123 api.test('count-objects_delta') +
124 api.properties(display_fetch_size=True))
125
126 yield (
127 api.test('count-objects_failed') +
128 api.step_data('count-objects', retcode=1))
129
130 yield (
131 api.test('count-objects_with_bad_output') +
132 api.step_data(
133 'count-objects',
134 stdout=api.raw_io.output(api.git.count_objects_output('xxx'))))
135
136 yield (
137 api.test('count-objects_with_bad_output_fails_build') +
138 api.step_data(
139 'count-objects',
140 stdout=api.raw_io.output(api.git.count_objects_output('xxx'))) +
141 api.properties(count_objects_can_fail_build=True))
142 yield (
143 api.test('cat-file_test') +
144 api.step_data('git cat-file abcdef12345:TestFile',
145 stdout=api.raw_io.output('TestOutput')) +
146 api.properties(revision='abcdef12345', cat_file='TestFile'))
OLDNEW
« no previous file with comments | « recipe_modules/git/api.py ('k') | recipe_modules/git/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698