mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[CHG] forwardport: automatically delegate original PR author on FP PRs
This way the original author can r+ the forward ports if they succeed (and probably requires no attention). Closes #195
This commit is contained in:
parent
73f27873a3
commit
ee8f81be2a
@ -443,10 +443,16 @@ class PullRequests(models.Model):
|
|||||||
# only link to previous PR of sequence if cherrypick passed
|
# only link to previous PR of sequence if cherrypick passed
|
||||||
'parent_id': pr.id if not has_conflicts else False,
|
'parent_id': pr.id if not has_conflicts else False,
|
||||||
})
|
})
|
||||||
|
# delegate original author on merged original PR & on new PR so
|
||||||
|
# they can r+ the forward ports (via mergebot or forwardbot)
|
||||||
|
source.author.write({
|
||||||
|
'delegate_reviewer': [
|
||||||
|
(4, source.id, False),
|
||||||
|
(4, new_pr.id, False),
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
assignees = (new_pr.source_id.author | new_pr.source_id.reviewed_by) \
|
assignees = (source.author | source.reviewed_by).mapped('github_login')
|
||||||
.filtered(lambda p: new_pr.source_id._pr_acl(p).is_reviewer) \
|
|
||||||
.mapped('github_login')
|
|
||||||
ping = "Ping %s" % ', '.join('@' + login for login in assignees if login)
|
ping = "Ping %s" % ', '.join('@' + login for login in assignees if login)
|
||||||
if h:
|
if h:
|
||||||
sout = serr = ''
|
sout = serr = ''
|
||||||
|
@ -191,14 +191,14 @@ def test_straightforward_flow(env, config, make_repo, users):
|
|||||||
}
|
}
|
||||||
assert prod.get_pr(pr2.number).comments == [
|
assert prod.get_pr(pr2.number).comments == [
|
||||||
(users['user'], """\
|
(users['user'], """\
|
||||||
Ping @%s
|
Ping @%s, @%s
|
||||||
This PR targets c and is the last of the forward-port chain.
|
This PR targets c and is the last of the forward-port chain.
|
||||||
|
|
||||||
To merge the full chain, say
|
To merge the full chain, say
|
||||||
> @%s r+
|
> @%s r+
|
||||||
|
|
||||||
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
|
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
|
||||||
""" % (users['reviewer'], project.fp_github_name)),
|
""" % (users['other'], users['reviewer'], project.fp_github_name)),
|
||||||
]
|
]
|
||||||
with prod:
|
with prod:
|
||||||
prod.post_status(pr2.head, 'success', 'ci/runbot')
|
prod.post_status(pr2.head, 'success', 'ci/runbot')
|
||||||
@ -822,21 +822,21 @@ def test_default_disabled(env, config, make_repo, users):
|
|||||||
assert len(cs) == 1
|
assert len(cs) == 1
|
||||||
assert pr2.comments == [
|
assert pr2.comments == [
|
||||||
(users['user'], """\
|
(users['user'], """\
|
||||||
Ping @%s
|
Ping @%s, @%s
|
||||||
This PR targets b and is the last of the forward-port chain.
|
This PR targets b and is the last of the forward-port chain.
|
||||||
|
|
||||||
To merge the full chain, say
|
To merge the full chain, say
|
||||||
> @%s r+
|
> @%s r+
|
||||||
|
|
||||||
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
|
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
|
||||||
""" % (users['reviewer'], users['user'])),
|
""" % (users['user'], users['reviewer'], users['user'])),
|
||||||
]
|
]
|
||||||
|
|
||||||
# reviewer = of the FP sequence, the original PR is always reviewed by `user`
|
# reviewer = of the FP sequence, the original PR is always reviewed by `user`
|
||||||
# set as reviewer
|
# set as reviewer
|
||||||
Case = collections.namedtuple('Case', 'author reviewer delegate success')
|
Case = collections.namedtuple('Case', 'author reviewer delegate success')
|
||||||
ACL = [
|
ACL = [
|
||||||
Case('reviewer', 'reviewer', None, False),
|
Case('reviewer', 'reviewer', None, True),
|
||||||
Case('reviewer', 'self_reviewer', None, False),
|
Case('reviewer', 'self_reviewer', None, False),
|
||||||
Case('reviewer', 'other', None, False),
|
Case('reviewer', 'other', None, False),
|
||||||
Case('reviewer', 'other', 'other', True),
|
Case('reviewer', 'other', 'other', True),
|
||||||
@ -848,7 +848,7 @@ ACL = [
|
|||||||
|
|
||||||
Case('other', 'reviewer', None, True),
|
Case('other', 'reviewer', None, True),
|
||||||
Case('other', 'self_reviewer', None, False),
|
Case('other', 'self_reviewer', None, False),
|
||||||
Case('other', 'other', None, False),
|
Case('other', 'other', None, True),
|
||||||
Case('other', 'other', 'other', True),
|
Case('other', 'other', 'other', True),
|
||||||
]
|
]
|
||||||
@pytest.mark.parametrize(Case._fields, ACL)
|
@pytest.mark.parametrize(Case._fields, ACL)
|
||||||
|
Loading…
Reference in New Issue
Block a user