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

pull/1/head
Simon Quigley 6 years ago
parent 605e65df66
commit e1a859fc5e

@ -225,7 +225,9 @@ def commithook():
if lpname:
# https://help.launchpad.net/Code/Git#Linking_to_bugs
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(", "):
goodtask = None
lbug = lp.load("/bugs/"+str(bug).strip())

Loading…
Cancel
Save