gitlab bot: no reset message on approvals 0/N

bot was overzealous in logging the approval reset message when seeing
pushes. this commit should keep it from logging the message if a push
happened but there weren't actually any approvals yet (so there's
nothing to reset)

still waiting on testing, but this seems like a decent fix to me

bss/dr.botzo#4
This commit is contained in:
Brian S. Stephan 2016-06-29 10:23:33 -05:00
parent dd0fa00e8e
commit 93c9224644
1 changed files with 4 additions and 1 deletions

View File

@ -127,8 +127,11 @@ class GitlabBot(object):
log.debug("merge request '%s', note '%s' is a system message", merge_request.title, note.id)
if re.match(r'Added \d+ commit', note.body):
log.debug("resetting approval list, '%s' looks like a push!", note.body)
# only set the unlogged approval reset flag if there's some kind of progress
if len(request_state.approver_list) > 0:
request_state.unlogged_approval_reset = True
request_state.approver_list.clear()
request_state.unlogged_approval_reset = True
else:
log.debug("leaving the approval list as it is, i don't think '%s' is a push", note.body)