[IMP] forwardport: warn when linked PR failed to FW

Before this change, if multiple co-dependent PRs get forward-ported
and one of them has a conflict the notice on the others is very
limited: they're tagged as `conflict` but there is no other
information provided in the PR description or in the subsequent
message.

Add a small warning to these other PRs, for clarity.

Closes #302
This commit is contained in:
Xavier Morel 2020-01-29 15:55:06 +01:00
parent 5a8f821de0
commit a0fe545d86

View File

@ -590,6 +590,15 @@ class PullRequests(models.Model):
] ]
}) })
footer = '\nMore info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port'
if has_conflicts and not h:
footer = '\nWarning: at least one co-dependent PR (%s) did ' \
'not properly forward-port, you will need to fix it ' \
'before this can be merged\n%s' % (
', '.join(p.display_name for p in conflicts),
footer
)
if h: if h:
sout = serr = '' sout = serr = ''
if out.strip(): if out.strip():
@ -598,12 +607,12 @@ class PullRequests(models.Model):
serr = "\nstderr:\n```\n%s\n```\n" % err serr = "\nstderr:\n```\n%s\n```\n" % err
message = source._pingline() + """ message = source._pingline() + """
Cherrypicking %s of source #%d failed Cherrypicking %s of source %s failed
%s%s %s%s
Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?). Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).
In the former case, you may want to edit this PR message as well. In the former case, you may want to edit this PR message as well.
""" % (h, source.number, sout, serr) """ % (h, source.display_name, sout, serr)
elif base._find_next_target(new_pr) is None: elif base._find_next_target(new_pr) is None:
ancestors = "".join( ancestors = "".join(
"* %s\n" % p.display_name "* %s\n" % p.display_name
@ -615,15 +624,11 @@ This PR targets %s and is the last of the forward-port chain%s
%s %s
To merge the full chain, say To merge the full chain, say
> @%s r+ > @%s r+
%s""" % (target.name, ' containing:' if ancestors else '.', ancestors, pr.repository.project_id.fp_github_name, footer)
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
""" % (target.name, ' containing:' if ancestors else '.', ancestors, pr.repository.project_id.fp_github_name)
else: else:
message = """\ message = """\
This PR targets %s and is part of the forward-port chain. Further PRs will be created up to %s. This PR targets %s and is part of the forward-port chain. Further PRs will be created up to %s.
%s""" % (target.name, base.limit_id.name, footer)
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
""" % (target.name, base.limit_id.name)
self.env['runbot_merge.pull_requests.feedback'].create({ self.env['runbot_merge.pull_requests.feedback'].create({
'repository': new_pr.repository.id, 'repository': new_pr.repository.id,
'pull_request': new_pr.number, 'pull_request': new_pr.number,