Skip to content

Commit

Permalink
fix assign (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
aguschin authored Sep 8, 2022
1 parent 6d69cfd commit 318ba38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gto/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,14 @@ def assign( # pylint: disable=too-many-locals
raise WrongArgs(
f"Can't register '{SemVer(name_version).version}', since '{found_version.version}' is registered already at this ref"
)
elif not skip_registration:
self.register(name, version=name_version, ref=ref, stdout=stdout)
else:
if not skip_registration:
self.register(
name, version=name_version, ref=ref, simple=True, stdout=stdout
)
found_version = self.find_artifact(name, create_new=True).find_version(
commit_hexsha=ref, create_new=True
)
if (
not force
and found_version
Expand Down
11 changes: 11 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,14 @@ def test_assign(repo_with_commit: Tuple[git.Repo, Callable]):
],
"❌ Version '1.0.0' is not valid. Example of valid version: 'v1.0.0'\n",
)

_check_successful_cmd(
"assign",
["-r", repo.working_dir, "nn2", "HEAD", "--stage", "prod"],
"Created git tag 'nn2@v0.0.1' that registers version\n"
"To push the changes upstream, run:\n"
" git push nn2@v0.0.1\n"
"Created git tag 'nn2#prod#1' that assigns stage to version 'v0.0.1'\n"
"To push the changes upstream, run:\n"
" git push nn2#prod#1\n",
)

0 comments on commit 318ba38

Please sign in to comment.