Switch to a regexp for finding requests in comments

Previously looked for the reqest strings anywhere in the comment, but
this breaks if someone quotes a request for some reason.
Switch to using a regexp instead.
This commit is contained in:
Jason Tibbitts 2011-04-18 12:55:50 -05:00
parent 8751ac45eb
commit 15b389eeb5

View file

@ -719,17 +719,17 @@ if __name__ == '__main__':
exit(1)
# Iterate over bugs
newre = re.compile('^New Package .* Request', re.MULTILINE)
changere = re.compile('^Package Change Request', re.MULTILINE)
for i in bugs:
firstfound = True
type = ''
print "Parsing bug %d - https://bugzilla.redhat.com/%d" % (i.bug_id, i.bug_id)
for j in reversed(comments['bugs'][str(i.bug_id)]['comments']):
if ('New Package CVS Request' in j['text']
or 'New Package GIT Request' in j['text']
or 'New Package SCM Request' in j['text']):
if newre.search(j['text']):
type = 'new'
break
if 'Package Change Request' in j['text']:
if changere.search(j['text']):
type = 'change'
break
firstfound = False