From b7d63ee507a94797c8da6de1a284cfd846f30b88 Mon Sep 17 00:00:00 2001 From: "whiteck-PC\\whiteck" Date: Tue, 14 Aug 2018 15:01:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A4=E6=96=ADgitlab=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=EF=BC=8C=E4=B8=8D=E8=83=BD=E9=80=82=E5=90=88?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=9A=84=E6=83=85=E5=86=B5,config=E5=8A=A0?= =?UTF-8?q?=E5=85=A5domain=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cobra/utils.py | 5 ++++- config.template | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cobra/utils.py b/cobra/utils.py index f3e7b656..7d77fffa 100644 --- a/cobra/utils.py +++ b/cobra/utils.py @@ -134,7 +134,10 @@ def target_directory(self, target_mode): target, branch = self.target, 'master' else: logger.critical('Target url exception: {u}'.format(u=self.target)) - if 'gitlab' in target: + # 只判断gitlab的关键字,不能适合所有的情况 + # 建议把这里设置为变量,从配置文件里面读取 + domain = Config('git', 'domain').value + if domain in target: username = Config('git', 'username').value password = Config('git', 'password').value else: diff --git a/config.template b/config.template index d9a6bef8..a8893692 100644 --- a/config.template +++ b/config.template @@ -52,6 +52,7 @@ password: [git] username: password: +domain: private_token: # http://xxx.gitlab.com/api/v3/projects/all gitlab_url: From 9ef2529f6c8387d1e75d5105fda52bfc1a896ee6 Mon Sep 17 00:00:00 2001 From: WeiZe Date: Thu, 27 Jun 2019 15:19:47 +0800 Subject: [PATCH 2/2] Update utils.py --- cobra/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cobra/utils.py b/cobra/utils.py index 7d77fffa..81a20aa9 100644 --- a/cobra/utils.py +++ b/cobra/utils.py @@ -134,8 +134,6 @@ def target_directory(self, target_mode): target, branch = self.target, 'master' else: logger.critical('Target url exception: {u}'.format(u=self.target)) - # 只判断gitlab的关键字,不能适合所有的情况 - # 建议把这里设置为变量,从配置文件里面读取 domain = Config('git', 'domain').value if domain in target: username = Config('git', 'username').value