Refactor config_util.py to use a list for the supported repository types

This commit is contained in:
bobo 2024-05-22 17:38:50 +08:00
parent 573824236f
commit a15f1a08a8

View File

@ -10,7 +10,15 @@ cache_repo_types = {}
# 支持的类型有github gitlab bitbucket bitbucket_server azure codecommit gerrit # 支持的类型有github gitlab bitbucket bitbucket_server azure codecommit gerrit
def get_repo_type(url): def get_repo_type(url):
# 根据URL的特征判断仓库管理类型 # 根据URL的特征判断仓库管理类型
support_repo_list = ["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"] support_repo_list = [
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit",
]
if "github.com" in url: if "github.com" in url:
return "github" return "github"
elif "gitlab.com" in url or "gitlab" in url: elif "gitlab.com" in url or "gitlab" in url: