2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 08:16:28 +00:00

Merge pull request #1247 from gavindsouza/dont-recompute-url

fix: Don't recompute url in App
This commit is contained in:
gavin 2022-01-04 18:14:14 +05:30 committed by GitHub
commit 409a32a47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,14 +30,13 @@ from bench.utils.bench import (
) )
from bench.utils.render import step from bench.utils.render import step
logger = logging.getLogger(bench.PROJECT_NAME)
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from bench.bench import Bench from bench.bench import Bench
logger = logging.getLogger(bench.PROJECT_NAME)
class AppMeta: class AppMeta:
def __init__(self, name: str, branch: str = None, to_clone: bool = True): def __init__(self, name: str, branch: str = None, to_clone: bool = True):
""" """
@ -61,6 +60,7 @@ class AppMeta:
self.on_disk = False self.on_disk = False
self.use_ssh = False self.use_ssh = False
self.from_apps = False self.from_apps = False
self.is_url = False
self.branch = branch self.branch = branch
self.setup_details() self.setup_details()
@ -81,6 +81,7 @@ class AppMeta:
# fetch meta for repo from remote git server - traditional get-app url # fetch meta for repo from remote git server - traditional get-app url
elif is_git_url(self.name): elif is_git_url(self.name):
self.is_url = True
if self.name.startswith("git@") or self.name.startswith("ssh://"): if self.name.startswith("git@") or self.name.startswith("ssh://"):
self.use_ssh = True self.use_ssh = True
self._setup_details_from_git_url() self._setup_details_from_git_url()
@ -108,9 +109,9 @@ class AppMeta:
if self.use_ssh: if self.use_ssh:
_first_part, _second_part = self.name.split(":") _first_part, _second_part = self.name.split(":")
self.remote_server = _first_part.split("@")[-1] self.remote_server = _first_part.split("@")[-1]
self.org, _repo = _second_part.split("/") self.org, _repo = _second_part.rsplit("/", 1)
else: else:
self.remote_server, self.org, _repo = self.name.split("/")[-3:] self.remote_server, self.org, _repo = self.name.rsplit("/", 2)
self.tag = self.branch self.tag = self.branch
self.repo = _repo.split(".")[0] self.repo = _repo.split(".")[0]
@ -123,6 +124,9 @@ class AppMeta:
if self.on_disk: if self.on_disk:
return os.path.abspath(self.name) return os.path.abspath(self.name)
if self.is_url:
return self.name
if self.use_ssh: if self.use_ssh:
return self.get_ssh_url() return self.get_ssh_url()