Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add repository type selection prompt in config_util.py #118

Open
wants to merge 2 commits into
base: scripts
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions merico/pr/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
# 支持的类型有:github gitlab bitbucket bitbucket_server azure codecommit gerrit
def get_repo_type(url):
# 根据URL的特征判断仓库管理类型
support_repo_list = [
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit",
]
if "github.com" in url:
return "github"
elif "gitlab.com" in url or "gitlab" in url:
Expand All @@ -28,21 +37,14 @@ def get_repo_type(url):
return cache_repo_types[url]
else:
radio = Radio(
["github", "gitlab", "bitbucket", "bitbucket_server", "azure", "codecommit", "gerrit"],
support_repo_list,
title="Choose the type of repository:",
)
radio.render()
if radio.selection is None:
return ""

rtype = [
"github",
"gitlab",
"bitbucket",
"bitbucket_server",
"azure",
"codecommit",
"gerrit",
][radio.selection]
rtype = support_repo_list[radio.selection]
cache_repo_types[url] = rtype
return rtype

Expand Down
Loading