Feature/parse git remote url with library #12

Merged
jt merged 2 commits from feature/parse-git-remote-url-with-library into main 2026-07-31 15:24:35 +00:00
Showing only changes of commit 11a48a922c - Show all commits
+10 -3
View File
@@ -1,6 +1,7 @@
import giturlparse
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
import giturlparse
from git_flow import SUPPORTED_REMOTE_URL_SCHEMAS, GitFlowError from git_flow import SUPPORTED_REMOTE_URL_SCHEMAS, GitFlowError
from git_flow.git import Git from git_flow.git import Git
@@ -28,11 +29,17 @@ class RemoteAPI(ABC):
raise GitFlowError(f"La URL del remoto {remote} es inválida: {url}") raise GitFlowError(f"La URL del remoto {remote} es inválida: {url}")
if not parsed_url.protocol in SUPPORTED_REMOTE_URL_SCHEMAS: if not parsed_url.protocol in SUPPORTED_REMOTE_URL_SCHEMAS:
raise GitFlowError(f"La URL del remoto {remote} no tiene un esquema soportado: {url}") raise GitFlowError(
f"La URL del remoto {remote} no tiene un esquema soportado: {url}"
)
# Cuando el host es seteado por pipeline puede ser "http://gitea/OWNER/REPO", en ese caso # Cuando el host es seteado por pipeline puede ser "http://gitea/OWNER/REPO", en ese caso
# la libreria parsea OWNER="" y REPO="OWNER/REPO" # la libreria parsea OWNER="" y REPO="OWNER/REPO"
repository = "/".join(filter(None, [parsed_url.owner, parsed_url.repo])).removeprefix("/").removesuffix(".git") repository = (
"/".join(filter(None, [parsed_url.owner, parsed_url.repo]))
.removeprefix("/")
.removesuffix(".git")
)
return [parsed_url.protocol + "://", parsed_url.host, repository] return [parsed_url.protocol + "://", parsed_url.host, repository]