[IMP] runbot_merge: drop merge method on squash

When moving from !squash to squash to !squash, it's a bit odd / risky
to keep the merge method as-is. So drop it.
This commit is contained in:
Xavier Morel 2020-05-28 13:27:34 +02:00 committed by xmo-odoo
parent b2a4da4739
commit 53b7c05701
2 changed files with 6 additions and 0 deletions

View File

@ -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')

View File

@ -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