diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 3dca4dcc..fd03822b 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -1055,6 +1055,9 @@ class PullRequests(models.Model): def write(self, vals): oldstate = { pr: pr._tagstate for pr in self } + if vals.get('squash'): + vals['merge_method'] = False + w = super().write(vals) newhead = vals.get('head') diff --git a/runbot_merge/tests/test_basic.py b/runbot_merge/tests/test_basic.py index 3a1e4b53..18112be6 100644 --- a/runbot_merge/tests/test_basic.py +++ b/runbot_merge/tests/test_basic.py @@ -1269,6 +1269,7 @@ class TestMergeMethod: ('repository.name', '=', repo.name), ('number', '=', prx.number), ]) + pr.merge_method = 'rebase-merge' assert not pr.squash, "a PR with a single commit should not be squashed" with repo: @@ -1278,6 +1279,8 @@ class TestMergeMethod: force=True ) assert pr.squash, "a PR with a single commit should be squashed" + assert not pr.merge_method, \ + "resetting a PR to a single commit should remove the merge method" def test_pr_no_method(self, repo, env, users, config): """ a multi-repo PR should not be staged by default, should also get