Refactor config_util.py to handle gitlab host input
This commit is contained in:
parent
14b3197543
commit
62b450d677
@ -1,10 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from lib.chatmark import TextEditor, Radio
|
from lib.chatmark import Radio, TextEditor
|
||||||
|
|
||||||
|
|
||||||
cache_repo_types = {}
|
cache_repo_types = {}
|
||||||
|
|
||||||
|
|
||||||
# 根据PR URL获取不同的仓库管理类型
|
# 根据PR URL获取不同的仓库管理类型
|
||||||
# 支持的类型有: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):
|
||||||
@ -27,29 +28,21 @@ 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"],
|
||||||
"github",
|
|
||||||
"gitlab",
|
|
||||||
"bitbucket",
|
|
||||||
"bitbucket_server",
|
|
||||||
"azure",
|
|
||||||
"codecommit",
|
|
||||||
"gerrit"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
radio.render()
|
radio.render()
|
||||||
if radio.selection is None:
|
if radio.selection is None:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
rtype = [
|
rtype = [
|
||||||
"github",
|
"github",
|
||||||
"gitlab",
|
"gitlab",
|
||||||
"bitbucket",
|
"bitbucket",
|
||||||
"bitbucket_server",
|
"bitbucket_server",
|
||||||
"azure",
|
"azure",
|
||||||
"codecommit",
|
"codecommit",
|
||||||
"gerrit"
|
"gerrit",
|
||||||
][radio.selection]
|
][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