Bugtracker: Use bug prefix to determine certainty and type.

This commit is contained in:
Krytarik Raido 2022-04-19 22:34:04 +02:00
parent d9bf187e2e
commit 2e3acd7da2
2 changed files with 9 additions and 5 deletions

View File

@ -23,7 +23,7 @@ import supybot
import supybot.world as world import supybot.world as world
from importlib import reload from importlib import reload
__version__ = "5.1.0" __version__ = "5.2.0"
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com") __author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com")
__contributors__ = { __contributors__ = {
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'], supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],

View File

@ -309,11 +309,11 @@ class Bugtracker(callbacks.PluginRegexp):
return msg return msg
def bugSnarfer(self, irc, msg, match): def bugSnarfer(self, irc, msg, match):
r"(?P<bt>[a-z][^\s:]*(\s+(bug|ticket|issue|pull|pr|merge|mr)('?s)?)?)(:+\s*#?|\s+#?|\s*#)(?P<bug>\d+(?!\d*[-.]\d+)(\s*([,\s]+|[,\s]*(and|und|en|et|ir|[&+]+))\s*#?\d+(?!\d*[-.]\d+))*)" r"(?P<bt>[a-z][^\s:]*(\s+(bug|ticket|issue|pull|pr|merge|mr)('?s)?)?)(?P<prefix>:+\s*[#!]?|\s+[#!]?|\s*[#!])(?P<bug>\d+(?!\d*[-.]\d+)(\s*([,\s]+|[,\s]*(and|und|en|et|ir|[&+]+))\s*#?\d+(?!\d*[-.]\d+))*)"
self.termSnarfer(irc, msg, match, 'bug') self.termSnarfer(irc, msg, match, 'bug')
def commitSnarfer(self, irc, msg, match): def commitSnarfer(self, irc, msg, match):
r"(?P<bt>[a-z][^\s:]*(\s+(commit)('?s)?)?)(:+\s*#?|\s+#?|\s*#)(?P<bug>[a-f0-9]{7,}(?![a-f0-9]*[-.][a-f0-9]{7,})(\s*([,\s]+|[,\s]*(and|und|en|et|ir|[&+]+))\s*#?[a-f0-9]{7,}(?![a-f0-9]*[-.][a-f0-9]{7,}))*)" r"(?P<bt>[a-z][^\s:]*(\s+(commit)('?s)?)?)(?P<prefix>:+\s*#?|\s+#?|\s*#)(?P<bug>[a-f0-9]{7,}(?![a-f0-9]*[-.][a-f0-9]{7,})(\s*([,\s]+|[,\s]*(and|und|en|et|ir|[&+]+))\s*#?[a-f0-9]{7,}(?![a-f0-9]*[-.][a-f0-9]{7,}))*)"
self.termSnarfer(irc, msg, match, 'commit') self.termSnarfer(irc, msg, match, 'commit')
def termSnarfer(self, irc, msg, match, termtype): def termSnarfer(self, irc, msg, match, termtype):
@ -347,13 +347,17 @@ class Bugtracker(callbacks.PluginRegexp):
# Get bug type # Get bug type
if sure_bug: if sure_bug:
bugtype = sure_bug.group('type') bugtype = sure_bug.group('type')
elif '#' in match.group('prefix'):
bugtype = 'bug'
elif '!' in match.group('prefix'):
bugtype = 'merge'
else: else:
bugtype = '' bugtype = ''
bugids = list(set(bugids)) # remove dupes bugids = list(set(bugids)) # remove dupes
if not sure_bug and termtype == 'bug': if termtype == 'bug' and not bugtype:
bugids = [x for x in bugids if int(x) > 100] bugids = [x for x in bugids if int(x) >= 100]
msg.tag('nbugs', nbugs + len(bugids)) msg.tag('nbugs', nbugs + len(bugids))