Remove json and presentation attributes from bot_update.Result.

All downstream uses have been updated, so the backward compatibility is
no longer necessary.

Bug: 339472834
Change-Id: Ie8434168e7d1255561e5f5434ea811f753f88835
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5534148
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
changes/48/5534148/2
Garrett Beaty 1 year ago committed by LUCI CQ
parent ede176e919
commit 4750254802

@ -57,18 +57,18 @@
Recipe module to ensure a checkout is consistent on a bot.
#### **class [BotUpdateApi](/recipes/recipe_modules/bot_update/api.py#93)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
#### **class [BotUpdateApi](/recipes/recipe_modules/bot_update/api.py#71)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/bot_update/api.py#101)(self, name, cmd, \*\*kwargs):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/bot_update/api.py#79)(self, name, cmd, \*\*kwargs):**
Wrapper for easy calling of bot_update.
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#693)(self, bot_update_result):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#668)(self, bot_update_result):**
Deapplies a patch, taking care of DEPS and solution revisions properly.
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#209)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, with_branch_heads=False, with_tags=False, no_fetch_tags=False, refs=None, clobber=False, root_solution_revision=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, assert_one_gerrit_change=True, patch_refs=None, ignore_input_commit=False, add_blamelists=False, set_output_commit=False, step_test_data=None, enforce_fetch=False, download_topics=False, recipe_revision_overrides=None, \*\*kwargs):**
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#187)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, with_branch_heads=False, with_tags=False, no_fetch_tags=False, refs=None, clobber=False, root_solution_revision=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, assert_one_gerrit_change=True, patch_refs=None, ignore_input_commit=False, add_blamelists=False, set_output_commit=False, step_test_data=None, enforce_fetch=False, download_topics=False, recipe_revision_overrides=None, \*\*kwargs):**
Args:
* gclient_config: The gclient configuration to use when running bot_update.
@ -104,7 +104,7 @@ Args:
change's commit message to get this revision override requested by the
author.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#670)(self, project_name, gclient_config=None):**
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#645)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of
a given project.
@ -118,9 +118,9 @@ Args:
Returns (list of str): All properties that'll hold the checked-out revision
of the given project. An empty list if no such properties exist.
&emsp; **@property**<br>&mdash; **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#120)(self):**
&emsp; **@property**<br>&mdash; **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#98)(self):**
&mdash; **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#621)(self, bot_update_json, name):**
&mdash; **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#596)(self, bot_update_result, name):**
Sets a fixed revision for a single dependency using project revision
properties.

@ -31,11 +31,6 @@ class RelativeRoot:
return cls(name=name, path=checkout_dir / name)
@dataclasses.dataclass(kw_only=True, frozen=True)
class Json:
output: dict[str, typing.Any]
class ManifestRepo(typing.TypedDict):
repository: str
revision: str
@ -72,23 +67,6 @@ class Result:
manifest: dict[str, ManifestRepo]
fixed_revisions: dict[str, str]
# TODO: crbug.com/339472834 - Once all downstream users are switched to use
# the above fields, these attributes and the property methods can be removed,
# as well as the Json type
_api: 'BotUpdateApi'
_presentation: StepPresentation
_json: Json
@property
def presentation(self):
self._api.m.warning.issue('BOT_UPDATE_CUSTOM_RESULT_ATTRIBUTES')
return self._presentation
@property
def json(self):
self._api.m.warning.issue('BOT_UPDATE_CUSTOM_RESULT_ATTRIBUTES')
return self._json
class BotUpdateApi(recipe_api.RecipeApi):
@ -586,9 +564,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
properties=result.get('properties', {}),
manifest=result.get('manifest', {}),
fixed_revisions=result.get('fixed_revisions', {}),
_api=self,
_presentation=step_result.presentation,
_json=Json(output=result),
)
def _destination_ref(self, cfg, path):
@ -618,13 +593,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
return self.m.tryserver.gerrit_change_target_ref
def resolve_fixed_revision(self, bot_update_json, name):
def resolve_fixed_revision(self, bot_update_result, name):
"""Sets a fixed revision for a single dependency using project revision
properties.
"""
rev_properties = self.get_project_revision_properties(name)
self.m.gclient.c.revisions = {
name: bot_update_json['properties'][rev_properties[0]]
name: bot_update_result.properties[rev_properties[0]]
}
def _resolve_fixed_revisions(self, bot_update_result):

@ -93,7 +93,7 @@ def RunSteps(api):
api.bot_update.deapply_patch(bot_update_step)
if api.properties.get('resolve_chromium_fixed_version'):
api.bot_update.resolve_fixed_revision(bot_update_step.json.output, 'src')
api.bot_update.resolve_fixed_revision(bot_update_step, 'src')
def GenTests(api):

@ -45,12 +45,6 @@ def RunSteps(api, expected_checkout_dir, expected_source_root_name,
else:
api.assertions.assertIsNone(result.patch_root)
api.assertions.assertEqual(result.properties, result.presentation.properties)
api.assertions.assertEqual(result.manifest,
result.json.output.get('manifest', {}))
api.assertions.assertEqual(result.fixed_revisions,
result.json.output.get('fixed_revisions', {}))
def GenTests(api):
yield api.test(

Loading…
Cancel
Save