Remove force parameter from bot_update.ensure_checkout.

This is the simplest change I can make here. The bot_update.py script already
ignores the value of force (and sets it to True in all cases). This is an
expectations-only change.

I'll refactor the content of the bot_update.py script to account for this
removed option in a followup CL as well.

R=agable@chromium.org, estaab@chromium.org, hinoka@chromium.org, martiniss@chromium.org
BUG=643885

Review-Url: https://codereview.chromium.org/2316323002
changes/18/399118/1
iannucci 9 years ago committed by Commit bot
parent 1332f33d42
commit 990ab1b42c

@ -67,7 +67,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
def ensure_checkout(self, gclient_config=None, suffix=None, def ensure_checkout(self, gclient_config=None, suffix=None,
patch=True, update_presentation=True, patch=True, update_presentation=True,
force=False, patch_root=None, no_shallow=False, patch_root=None, no_shallow=False,
with_branch_heads=False, refs=None, with_branch_heads=False, refs=None,
patch_oauth2=False, use_site_config_creds=True, patch_oauth2=False, use_site_config_creds=True,
output_manifest=True, clobber=False, output_manifest=True, clobber=False,
@ -214,8 +214,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
if clobber: if clobber:
cmd.append('--clobber') cmd.append('--clobber')
if force:
cmd.append('--force')
if no_shallow: if no_shallow:
cmd.append('--no_shallow') cmd.append('--no_shallow')
if output_manifest: if output_manifest:
@ -230,8 +228,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
# Inject Json output for testing. # Inject Json output for testing.
first_sln = cfg.solutions[0].name first_sln = cfg.solutions[0].name
step_test_data = lambda: self.test_api.output_json( step_test_data = lambda: self.test_api.output_json(
master, builder, slave, root, first_sln, rev_map, force, master, builder, slave, root, first_sln, rev_map, self._fail_patch,
self._fail_patch,
output_manifest=output_manifest, fixed_revisions=fixed_revisions) output_manifest=output_manifest, fixed_revisions=fixed_revisions)
# Add suffixes to the step name, if specified. # Add suffixes to the step name, if specified.

@ -1,57 +0,0 @@
[
{
"cmd": [
"python",
"-u",
"RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
"--master",
"experimental",
"--builder",
"Experimental Builder",
"--slave",
"somehost",
"--spec",
"cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]",
"--root",
"src",
"--revision_mapping_file",
"{\"src\": \"got_cr_revision\"}",
"--git-cache-dir",
"[GIT_CACHE]",
"--output_json",
"/path/to/tmp/json",
"--revision",
"src@HEAD",
"--force"
],
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]"
},
"name": "bot_update",
"~followup_annotations": [
"@@@STEP_TEXT@Some step text@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@",
"@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"src\": \"HEAD\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
"@@@STEP_LOG_END@json.output@@@",
"@@@SET_BUILD_PROPERTY@got_cr_revision@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@",
"@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]

@ -25,7 +25,6 @@ def RunSteps(api):
'HEAD') 'HEAD')
patch = api.properties.get('patch', True) patch = api.properties.get('patch', True)
clobber = True if api.properties.get('clobber') else False clobber = True if api.properties.get('clobber') else False
force = True if api.properties.get('force') else False
no_shallow = True if api.properties.get('no_shallow') else False no_shallow = True if api.properties.get('no_shallow') else False
output_manifest = api.properties.get('output_manifest', False) output_manifest = api.properties.get('output_manifest', False)
with_branch_heads = api.properties.get('with_branch_heads', False) with_branch_heads = api.properties.get('with_branch_heads', False)
@ -44,7 +43,6 @@ def RunSteps(api):
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref) gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref)
else: else:
api.bot_update.ensure_checkout( api.bot_update.ensure_checkout(
force=force,
no_shallow=no_shallow, no_shallow=no_shallow,
patch=patch, patch=patch,
with_branch_heads=with_branch_heads, with_branch_heads=with_branch_heads,
@ -124,12 +122,6 @@ def GenTests(api):
rietveld='https://rietveld.example.com/', rietveld='https://rietveld.example.com/',
fail_patch='download' fail_patch='download'
) + api.step_data('bot_update', retcode=87) ) + api.step_data('bot_update', retcode=87)
yield api.test('forced') + api.properties(
mastername='experimental',
buildername='Experimental Builder',
slavename='somehost',
force=1
)
yield api.test('no_shallow') + api.properties( yield api.test('no_shallow') + api.properties(
mastername='experimental', mastername='experimental',
buildername='Experimental Builder', buildername='Experimental Builder',

@ -11,57 +11,53 @@ from recipe_engine import recipe_test_api
class BotUpdateTestApi(recipe_test_api.RecipeTestApi): class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
def output_json(self, master, builder, slave, root, first_sln, def output_json(self, master, builder, slave, root, first_sln,
revision_mapping, force=False, fail_patch=False, revision_mapping, fail_patch=False,
output_manifest=False, fixed_revisions=None): output_manifest=False, fixed_revisions=None):
"""Deterministically synthesize json.output test data for gclient's """Deterministically synthesize json.output test data for gclient's
--output-json option. --output-json option.
""" """
active = True
output = { output = {
'did_run': active, 'did_run': True,
'patch_failure': False 'patch_failure': False
} }
# Add in extra json output if active. properties = {
if active: property_name: self.gen_revision(project_name)
properties = { for project_name, property_name in revision_mapping.iteritems()
property_name: self.gen_revision(project_name) }
for project_name, property_name in revision_mapping.iteritems() properties.update({
} '%s_cp' % property_name: ('refs/heads/master@{#%s}' %
properties.update({ self.gen_commit_position(project_name))
'%s_cp' % property_name: ('refs/heads/master@{#%s}' % for project_name, property_name in revision_mapping.iteritems()
self.gen_commit_position(project_name)) })
for project_name, property_name in revision_mapping.iteritems()
})
output.update({ output.update({
'patch_root': root or first_sln, 'patch_root': root or first_sln,
'root': first_sln, 'root': first_sln,
'properties': properties, 'properties': properties,
'step_text': 'Some step text' 'step_text': 'Some step text'
}) })
if output_manifest: if output_manifest:
output.update({ output.update({
'manifest': { 'manifest': {
project_name: { project_name: {
'repository': 'https://fake.org/%s.git' % project_name, 'repository': 'https://fake.org/%s.git' % project_name,
'revision': self.gen_revision(project_name), 'revision': self.gen_revision(project_name),
}
for project_name in revision_mapping
} }
}) for project_name in revision_mapping
}
})
if fixed_revisions: if fixed_revisions:
output['fixed_revisions'] = fixed_revisions output['fixed_revisions'] = fixed_revisions
if fail_patch: if fail_patch:
output['log_lines'] = [('patch error', 'Patch failed to apply'),] output['log_lines'] = [('patch error', 'Patch failed to apply'),]
output['patch_failure'] = True output['patch_failure'] = True
output['patch_apply_return_code'] = 1 output['patch_apply_return_code'] = 1
if fail_patch == 'download': if fail_patch == 'download':
output['patch_apply_return_code'] = 3 output['patch_apply_return_code'] = 3
return self.m.json.output(output) return self.m.json.output(output)
@staticmethod @staticmethod

Loading…
Cancel
Save