Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow squash in single merge request mode #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion marge/merge_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,14 @@ def rebase(self):

raise TimeoutError('Waiting for merge request to be rebased by GitLab')

def accept(self, remove_branch=False, sha=None, merge_when_pipeline_succeeds=True):
def accept(self, remove_branch=False, sha=None, merge_when_pipeline_succeeds=True, auto_squash=False):
return self._api.call(PUT(
'/projects/{0.project_id}/merge_requests/{0.iid}/merge'.format(self),
dict(
should_remove_source_branch=remove_branch,
merge_when_pipeline_succeeds=merge_when_pipeline_succeeds,
sha=sha or self.sha, # if provided, ensures what is merged is what we want (or fails)
squash=auto_squash
),
))

Expand Down
1 change: 1 addition & 0 deletions marge/single_merge_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def update_merge_request_and_accept(self, approvals):
remove_branch=merge_request.force_remove_source_branch,
sha=actual_sha,
merge_when_pipeline_succeeds=bool(target_project.only_allow_merge_if_pipeline_succeeds),
auto_squash=merge_request.squash
)
log.info('merge_request.accept result: %s', ret)
except gitlab.NotAcceptable as err:
Expand Down