diff --git a/src/git_flow/command/tag.py b/src/git_flow/command/tag.py index f7e4b09..1c652ea 100644 --- a/src/git_flow/command/tag.py +++ b/src/git_flow/command/tag.py @@ -7,7 +7,7 @@ from git_flow import ( GitFlowError, ) from git_flow.changelog import Changelog -from git_flow.command.base import * +import git_flow.command.base as base from git_flow.git import Git from typing import Optional import typer @@ -18,22 +18,22 @@ app = typer.Typer() @app.command() def tag(token: Optional[str] = None): """Crea un nuevo tag para el último merge.""" - ensure_initialized() + base.ensure_initialized() target = Git.get_current_branch() - if target not in environments: + if target not in base.environments: raise GitFlowError("Solo se pueden taggear commits en ramas principales.") branch = Git( "show", get_last_merge_commit() + "^2", patch=False, format="%h" ).firstline() - base = Git.get_first_fork_point(branch, target) - commits = Git("log", base + ".." + branch, format="%s").lines() + fork_point = Git.get_first_fork_point(branch, target) + commits = Git("log", fork_point + ".." + branch, format="%s").lines() next_tag = get_next_tag_from_commits(commits, target) if not next_tag: - info( + base.io_info( "Los cambios realizados no implican un salto de versión, se mantiene la anterior." ) return @@ -45,21 +45,21 @@ def tag(token: Optional[str] = None): changelog = Changelog() - changelog.update(next_tag, base, branch) + changelog.update(next_tag, fork_point, branch) Git("add", Changelog.FILENAME).exec(print="Agregando nuevo CHANGELOG.md") Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print="Creando commit") tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline() if ci: Git("push").exec(print="Subiendo commit al remoto para taggearlo") - success(get_remote_api(token).create_tag(next_tag, tag_commit)) + base.io_success(base.get_remote_api(token).create_tag(next_tag, tag_commit)) Git("tag", next_tag, tag_commit).exec(print="Creando tag localmente") def get_token_and_ci(token: Optional[str]): try: - return (ensure_repository_token(), False) + return (base.ensure_repository_token(), False) except GitFlowError: return (token, True)