Skip to content

Commit

Permalink
Add merge_commit_sha and mergeable @properties to
Browse files Browse the repository at this point in the history
pull_request.py:GitlabPullRequest.

'merge_commit_sha' maps exactly; however, in GitLab, the closest thing
to 'mergeable' appears to be 'merge_status', which is a string that
can take on values

- "unchecked"
- "checking"
- "can_be_merged"
- "cannot_be_merged"
- "cannot_be_merged_recheck"

For now, at least, we'll map "can_be_merged" to mergeable = True,
and everything else to False.

Signed-off-by: Ben Crocker <[email protected]>
  • Loading branch information
bcrocker15 committed Jun 14, 2021
1 parent 066044c commit 5d3f5b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ogr/services/gitlab/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ def commits_url(self) -> str:
def head_commit(self) -> str:
return self._raw_pr.sha

@property
def merge_commit_sha(self) -> str:
return self._raw_pr.merge_commit_sha

@property
def mergeable(self) -> bool:
if self._raw_pr.merge_status == "can_be_merged":
return True
return False

@property
def source_project(self) -> "ogr_gitlab.GitlabProject":
if self._source_project is None:
Expand Down

0 comments on commit 5d3f5b5

Please sign in to comment.