From 93c9224644af3de0aa883ce80722244be3c83739 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 29 Jun 2016 10:23:33 -0500 Subject: [PATCH] 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 --- dr_botzo/gitlab_bot/lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dr_botzo/gitlab_bot/lib.py b/dr_botzo/gitlab_bot/lib.py index 8b731e8..e7316a4 100644 --- a/dr_botzo/gitlab_bot/lib.py +++ b/dr_botzo/gitlab_bot/lib.py @@ -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)