smarkets / marge-bot

A merge-bot for GitLab
BSD 3-Clause "New" or "Revised" License
700 stars 136 forks source link

Improve error message when assigned to MR with unresolved threads #317

Closed arvidj closed 3 years ago

arvidj commented 3 years ago

Currently, the message posted by marge on when attempting to merge an MR with outstanding threads is only:

I couldn't merge this branch: Merge request was rejected by GitLab: 'Branch cannot be merged'

and the log message is:

  | 2021-07-08 11:01:26,671 WARNING I couldn't merge this branch: Merge request was rejected by GitLab: 'Branch cannot be merged'

This could be improved by extending

def ensure_mergeable_mr(self, merge_request):

by retrieving all notes in the mr, and checking that all notes that are resolvable are also resolved.

snim2 commented 3 years ago

I think it might be even simpler than that. In the GitLab MR API there's a JSON key blocking_discussions_resolved which we can check.

snim2 commented 3 years ago

OK, PR up and ready for review...