| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 'git', | 6 'git', |
| 7 'recipe_engine/path', | 7 'recipe_engine/path', |
| 8 'recipe_engine/platform', | 8 'recipe_engine/platform', |
| 9 'recipe_engine/properties', | 9 'recipe_engine/properties', |
| 10 'recipe_engine/raw_io', | 10 'recipe_engine/raw_io', |
| 11 'recipe_engine/step', | 11 'recipe_engine/step', |
| 12 ] | 12 ] |
| 13 | 13 |
| 14 | 14 |
| 15 def RunSteps(api): | 15 def RunSteps(api): |
| 16 url = 'https://chromium.googlesource.com/chromium/src.git' | 16 url = 'https://chromium.googlesource.com/chromium/src.git' |
| 17 | 17 |
| 18 # git.checkout can optionally dump GIT_CURL_VERBOSE traces to a log file, | 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. | 19 # useful for debugging git access issues that are reproducible only on bots. |
| 20 curl_trace_file = None | 20 curl_trace_file = None |
| 21 if api.properties.get('use_curl_trace'): | 21 if api.properties.get('use_curl_trace'): |
| 22 curl_trace_file = api.path['slave_build'].join('curl_trace.log') | 22 curl_trace_file = api.path['slave_build'].join('curl_trace.log') |
| 23 | 23 |
| 24 submodule_update_force = api.properties.get('submodule_update_force', False) | 24 submodule_update_force = api.properties.get('submodule_update_force', False) |
| 25 submodule_update_recursive = api.properties.get('submodule_update_recursive', | 25 submodule_update_recursive = api.properties.get('submodule_update_recursive', |
| 26 True) | 26 True) |
| 27 | 27 |
| 28 # You can use api.git.checkout to perform all the steps of a safe checkout. | 28 # You can use api.git.checkout to perform all the steps of a safe checkout. |
| 29 api.git.checkout( | 29 set_got_revision=api.properties.get('set_got_revision') |
| 30 retVal = api.git.checkout( |
| 30 url, | 31 url, |
| 31 ref=api.properties.get('revision'), | 32 ref=api.properties.get('revision'), |
| 32 recursive=True, | 33 recursive=True, |
| 33 submodule_update_force=submodule_update_force, | 34 submodule_update_force=submodule_update_force, |
| 34 set_got_revision=api.properties.get('set_got_revision'), | 35 set_got_revision=set_got_revision, |
| 35 curl_trace_file=curl_trace_file, | 36 curl_trace_file=curl_trace_file, |
| 36 remote_name=api.properties.get('remote_name'), | 37 remote_name=api.properties.get('remote_name'), |
| 37 display_fetch_size=api.properties.get('display_fetch_size'), | 38 display_fetch_size=api.properties.get('display_fetch_size'), |
| 38 file_name=api.properties.get('checkout_file_name'), | 39 file_name=api.properties.get('checkout_file_name'), |
| 39 submodule_update_recursive=submodule_update_recursive) | 40 submodule_update_recursive=submodule_update_recursive) |
| 40 | 41 |
| 42 if set_got_revision: |
| 43 assert retVal == api.properties['expected_got_revision'], ( |
| 44 "expected retVal to be %r but was %r" % ( |
| 45 api.properties['expected_got_revision'], retVal)) |
| 46 |
| 41 # count_objects shows number and size of objects in .git dir. | 47 # count_objects shows number and size of objects in .git dir. |
| 42 api.git.count_objects( | 48 api.git.count_objects( |
| 43 name='count-objects', | 49 name='count-objects', |
| 44 can_fail_build=api.properties.get('count_objects_can_fail_build'), | 50 can_fail_build=api.properties.get('count_objects_can_fail_build'), |
| 45 git_config_options={'foo': 'bar'}) | 51 git_config_options={'foo': 'bar'}) |
| 46 | 52 |
| 47 # Get the remote URL. | 53 # Get the remote URL. |
| 48 api.git.get_remote_url( | 54 api.git.get_remote_url( |
| 49 step_test_data=lambda: api.raw_io.test_api.stream_output('foo')) | 55 step_test_data=lambda: api.raw_io.test_api.stream_output('foo')) |
| 50 | 56 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 api.step_data('git status can_fail_build', retcode=1) | 106 api.step_data('git status can_fail_build', retcode=1) |
| 101 ) | 107 ) |
| 102 | 108 |
| 103 yield ( | 109 yield ( |
| 104 api.test('cannot_fail_build') + | 110 api.test('cannot_fail_build') + |
| 105 api.step_data('git status cannot_fail_build', retcode=1) | 111 api.step_data('git status cannot_fail_build', retcode=1) |
| 106 ) | 112 ) |
| 107 | 113 |
| 108 yield ( | 114 yield ( |
| 109 api.test('set_got_revision') + | 115 api.test('set_got_revision') + |
| 110 api.properties(set_got_revision=True) + | 116 api.properties( |
| 117 set_got_revision=True, |
| 118 expected_got_revision="deadbeef", |
| 119 ) + |
| 111 api.step_data('set got_revision', | 120 api.step_data('set got_revision', |
| 112 stdout=api.raw_io.output('deadbeef')) | 121 stdout=api.raw_io.output('deadbeef')) |
| 113 ) | 122 ) |
| 114 | 123 |
| 115 yield ( | 124 yield ( |
| 116 api.test('rebase_failed') + | 125 api.test('rebase_failed') + |
| 117 api.step_data('my repo rebase', retcode=1) | 126 api.step_data('my repo rebase', retcode=1) |
| 118 ) | 127 ) |
| 119 | 128 |
| 120 yield api.test('remote_not_origin') + api.properties(remote_name='not_origin') | 129 yield api.test('remote_not_origin') + api.properties(remote_name='not_origin') |
| (...skipping 16 matching lines...) Expand all Loading... |
| 137 api.test('count-objects_with_bad_output_fails_build') + | 146 api.test('count-objects_with_bad_output_fails_build') + |
| 138 api.step_data( | 147 api.step_data( |
| 139 'count-objects', | 148 'count-objects', |
| 140 stdout=api.raw_io.output(api.git.count_objects_output('xxx'))) + | 149 stdout=api.raw_io.output(api.git.count_objects_output('xxx'))) + |
| 141 api.properties(count_objects_can_fail_build=True)) | 150 api.properties(count_objects_can_fail_build=True)) |
| 142 yield ( | 151 yield ( |
| 143 api.test('cat-file_test') + | 152 api.test('cat-file_test') + |
| 144 api.step_data('git cat-file abcdef12345:TestFile', | 153 api.step_data('git cat-file abcdef12345:TestFile', |
| 145 stdout=api.raw_io.output('TestOutput')) + | 154 stdout=api.raw_io.output('TestOutput')) + |
| 146 api.properties(revision='abcdef12345', cat_file='TestFile')) | 155 api.properties(revision='abcdef12345', cat_file='TestFile')) |
| OLD | NEW |