Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
ba8985b8
Commit
ba8985b8
authored
Oct 18, 2019
by
Samuel GAIST
Browse files
[toolchains] Port to AssetCommand and implement dependency handling for push
parent
24e08881
Changes
2
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/test/test_toolchains.py
View file @
ba8985b8
...
...
@@ -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
):
...
...
beat/cmdline/toolchains.py
View file @
ba8985b8
...
...
@@ -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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment