mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[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:
parent
b2a4da4739
commit
53b7c05701
@ -1055,6 +1055,9 @@ class PullRequests(models.Model):
|
|||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
oldstate = { pr: pr._tagstate for pr in self }
|
oldstate = { pr: pr._tagstate for pr in self }
|
||||||
|
|
||||||
|
if vals.get('squash'):
|
||||||
|
vals['merge_method'] = False
|
||||||
|
|
||||||
w = super().write(vals)
|
w = super().write(vals)
|
||||||
|
|
||||||
newhead = vals.get('head')
|
newhead = vals.get('head')
|
||||||
|
@ -1269,6 +1269,7 @@ class TestMergeMethod:
|
|||||||
('repository.name', '=', repo.name),
|
('repository.name', '=', repo.name),
|
||||||
('number', '=', prx.number),
|
('number', '=', prx.number),
|
||||||
])
|
])
|
||||||
|
pr.merge_method = 'rebase-merge'
|
||||||
assert not pr.squash, "a PR with a single commit should not be squashed"
|
assert not pr.squash, "a PR with a single commit should not be squashed"
|
||||||
|
|
||||||
with repo:
|
with repo:
|
||||||
@ -1278,6 +1279,8 @@ class TestMergeMethod:
|
|||||||
force=True
|
force=True
|
||||||
)
|
)
|
||||||
assert pr.squash, "a PR with a single commit should be squashed"
|
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):
|
def test_pr_no_method(self, repo, env, users, config):
|
||||||
""" a multi-repo PR should not be staged by default, should also get
|
""" a multi-repo PR should not be staged by default, should also get
|
||||||
|
Loading…
Reference in New Issue
Block a user