Don't fail if the regex doesn't match.

This commit is contained in:
Simon Quigley 2018-08-16 14:19:59 -05:00
parent 605e65df66
commit e1a859fc5e

4
lugito
View File

@ -225,7 +225,9 @@ def commithook():
if lpname: if lpname:
# https://help.launchpad.net/Code/Git#Linking_to_bugs # https://help.launchpad.net/Code/Git#Linking_to_bugs
regexp = re.compile(r"lp:\s+\#\d+(?:,\s*\#\d+)*") regexp = re.compile(r"lp:\s+\#\d+(?:,\s*\#\d+)*")
lpbugs = regexp.search(commitmessage.lower()).group(0).strip("lp: ").replace("#", "") regexpsearch = regexp.search(commitmessage.lower())
if regexpsearch:
lpbugs = regexpsearch.group(0).strip("lp: ").replace("#", "")
for bug in lpbugs.split(", "): for bug in lpbugs.split(", "):
goodtask = None goodtask = None
lbug = lp.load("/bugs/"+str(bug).strip()) lbug = lp.load("/bugs/"+str(bug).strip())