Bugtracker: Update GitLab tracker.
This commit is contained in:
@ -24,7 +24,7 @@ import supybot.world as world
|
||||
|
||||
from imp import reload
|
||||
|
||||
__version__ = "3.6.0"
|
||||
__version__ = "3.7.0"
|
||||
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com")
|
||||
__contributors__ = {
|
||||
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],
|
||||
|
@ -952,7 +952,7 @@ class GitHub(IBugtracker):
|
||||
except Exception as e:
|
||||
raise BugtrackerError(self.errget % (self.description, e, url))
|
||||
try:
|
||||
product = '/'.join(url.split('/')[-4:-2])
|
||||
product = '/'.join(self.url.split('/')[-3:-1])
|
||||
if 'merged' in bug and bug['merged']:
|
||||
status = 'Merged'
|
||||
else:
|
||||
@ -972,7 +972,8 @@ class GitLab(IBugtracker):
|
||||
desc = match.group(0)
|
||||
name = desc.lower()
|
||||
url = 'https://%s' % desc
|
||||
bugurl = '%s/%d.json' % (url, id)
|
||||
bugurl = "%s/%d" % (re.sub(r'(://[^\s/]+)/([^\s/]+)/([^\s/]+)',
|
||||
r'\g<1>/api/v4/projects/\g<2>%2F\g<3>', url), id)
|
||||
bugjson = utils.web.getUrl(bugurl)
|
||||
bug = json.loads(bugjson.decode('utf-8'))
|
||||
return GitLab(name, url, desc, 'gitlab')
|
||||
@ -980,20 +981,25 @@ class GitLab(IBugtracker):
|
||||
pass
|
||||
|
||||
def get_bug(self, id):
|
||||
url = "%s/%d.json" % (self.url, id)
|
||||
url = "%s/%d" % (re.sub(r'(://[^\s/]+)/([^\s/]+)/([^\s/]+)',
|
||||
r'\g<1>/api/v4/projects/\g<2>%2F\g<3>', self.url), id)
|
||||
try:
|
||||
bugjson = utils.web.getUrl(url)
|
||||
bug = json.loads(bugjson.decode('utf-8'))
|
||||
except Exception as e:
|
||||
raise BugtrackerError(self.errget % (self.description, e, url))
|
||||
try:
|
||||
product = '/'.join(url.split('/')[-4:-2])
|
||||
product = '/'.join(self.url.split('/')[-3:-1])
|
||||
status = bug['state']
|
||||
if 'assignees' in bug and bug['assignees']:
|
||||
if bug['assignees']:
|
||||
assino = len(bug['assignees'])
|
||||
if assino == 1:
|
||||
assignee = bug['assignees'][0]['name']
|
||||
else:
|
||||
assignee = '%d people' % assino
|
||||
else:
|
||||
assignee = ''
|
||||
return (id, product, bug['title'], '', status, assignee, "%s/%d" % (self.url, id), [], [])
|
||||
return (id, product, bug['title'], '', status, assignee, bug['web_url'], [], [])
|
||||
except Exception as e:
|
||||
raise BugtrackerError(self.errparse % (self.description, e, url))
|
||||
|
||||
@ -1019,7 +1025,7 @@ class Gitea(IBugtracker):
|
||||
except Exception as e:
|
||||
raise BugtrackerError(self.errget % (self.description, e, url))
|
||||
try:
|
||||
product = '/'.join(url.split('/')[-4:-2])
|
||||
product = '/'.join(self.url.split('/')[-3:-1])
|
||||
if 'merged' in bug and bug['merged']:
|
||||
status = 'Merged'
|
||||
else:
|
||||
|
Reference in New Issue
Block a user