Commit ba8985b8 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[toolchains] Port to AssetCommand and implement dependency handling for push

parent 24e08881
......@@ -53,6 +53,8 @@ class TestOnlineToolchains(core.OnlineAssetTestCase):
"pull": "user/single/1",
"diff": "user/single/1",
"create": "user/newobject/1",
"push": "user/two_loops/1",
"not_owner_push": "other_user/somechain/1",
}
def _modify_asset(self, asset_name):
......
......@@ -41,6 +41,16 @@ from . import commands
from .decorators import raise_on_error
from .click_helper import AliasedGroup
from .click_helper import AssetCommand
from .click_helper import AssetInfo
class ToolchainCommand(AssetCommand):
asset_info = AssetInfo(
asset_type="toolchain",
diff_fields=["declaration", "description"],
push_fields=["name", "declaration", "description"],
)
@click.group(cls=AliasedGroup)
......@@ -48,9 +58,6 @@ from .click_helper import AliasedGroup
def toolchains(ctx):
"""toolchains commands"""
ctx.meta["asset_type"] = "toolchain"
ctx.meta["diff_fields"] = ["declaration", "description"]
CMD_LIST = [
"list",
......@@ -63,9 +70,10 @@ CMD_LIST = [
"fork",
"rm",
"diff",
"push",
]
commands.initialise_asset_commands(toolchains, CMD_LIST)
commands.initialise_asset_commands(toolchains, CMD_LIST, ToolchainCommand)
@toolchains.command()
......@@ -93,38 +101,6 @@ def pull(ctx, names, force):
return status
@toolchains.command()
@click.argument("names", nargs=-1)
@click.option(
"--force", help="Performs operation regardless of conflicts", is_flag=True
)
@click.option(
"--dry-run",
help="Doesn't really perform the task, just " "comments what would do",
is_flag=True,
)
@click.pass_context
@raise_on_error
def push(ctx, names, force, dry_run):
"""Uploads toolchains to the server
Example:
$ beat toolchains push --dry-run yyy
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return common.push(
webapi,
ctx.meta["config"].path,
"toolchain",
names,
["name", "declaration", "description"],
{},
force,
dry_run,
0,
)
@toolchains.command()
@click.argument("names", nargs=-1)
@click.option(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment