Compare commits
2 Commits
scripts
...
add_repo_t
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a15f1a08a8 | ||
![]() |
573824236f |
@ -10,6 +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",
|
||||||
|
]
|
||||||
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:
|
||||||
@ -28,21 +37,14 @@ def get_repo_type(url):
|
|||||||
return cache_repo_types[url]
|
return cache_repo_types[url]
|
||||||
else:
|
else:
|
||||||
radio = Radio(
|
radio = Radio(
|
||||||
["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"],
|
support_repo_list,
|
||||||
|
title="Choose the type of repository:",
|
||||||
)
|
)
|
||||||
radio.render()
|
radio.render()
|
||||||
if radio.selection is None:
|
if radio.selection is None:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
rtype = [
|
rtype = support_repo_list[radio.selection]
|
||||||
"github",
|
|
||||||
"gitlab",
|
|
||||||
"bitbucket",
|
|
||||||
"bitbucket_server",
|
|
||||||
"azure",
|
|
||||||
"codecommit",
|
|
||||||
"gerrit",
|
|
||||||
][radio.selection]
|
|
||||||
cache_repo_types[url] = rtype
|
cache_repo_types[url] = rtype
|
||||||
return rtype
|
return rtype
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user