util: Fix gerrit bot commit subject parser
Currently, if the commit subject does have tags, the parser will return the list of tags as a NoneType object, which will be iterated later. This caused the gerrit bot to fail. This change lets the parser return the list of tags as an empty list rather than a NoneType object. Also, a commit subject without a semicolon `:` will be assumed as having no tags and the whole subject is the commit message. Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Change-Id: Ie8c90e14bb85c4ce1c583121d02e75aa87db7811 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48586 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby R. Bruce
parent
9bd381cef6
commit
1e30ade018
@@ -30,9 +30,10 @@ def parse_commit_subject(subject):
|
||||
parsed_subject = subject.split(":", maxsplit = 1)
|
||||
|
||||
# If the subject does not have a colon, it either does not have tags
|
||||
# or does not have a message
|
||||
# or does not have a message. In this case, we assume that the subject
|
||||
# is the commit message.
|
||||
if len(parsed_subject) <= 1:
|
||||
return None, None
|
||||
return [], parsed_subject[0]
|
||||
|
||||
tags = [ tag.strip() for tag in parsed_subject[0].split(",") ]
|
||||
message = parsed_subject[1]
|
||||
|
||||
Reference in New Issue
Block a user