[IMP] forwardport: link FP PRs to both root and source

In the case where an FP sequence is interrupted (e.g. there was a
conflict during one of the intermediate steps), followups get linked
to the original source but don't get linked to the "interruption" PR
which is a bit confusing.

Link FP PRs to both source and root if they're different.
This commit is contained in:
Xavier Morel 2019-09-20 11:02:53 +02:00
parent 6d4923928a
commit 446b11a28f
2 changed files with 10 additions and 4 deletions

View File

@ -438,7 +438,11 @@ class PullRequests(models.Model):
message += '\n\n'
else:
message = ''
message += "Forward-Port-Of: %s#%s" % (source.repository.name, source.number)
root = pr._get_root()
message += '\n'.join(
"Forward-Port-Of: %s#%s" % (p.repository.name, p.number)
for p in root | source
)
(h, out, err) = conflicts.get(pr) or (None, None, None)

View File

@ -379,9 +379,6 @@ a
}
def test_conflict(env, config, make_repo):
""" If there's a conflict when forward-porting the commit, commit the
conflict and create a draft PR.
"""
prod, other = make_basic(env, config, make_repo)
# reset b to b~1 (g=a) parent so there's no b -> c conflict
with prod:
@ -454,6 +451,7 @@ xxx
'g': 'xxx',
}
assert pr1.state == 'opened', "state should be open still"
assert ('#%d' % pr.number) in pr1.message
# check that merging the fixed PR fixes the flow and restarts a forward
# port process
@ -470,6 +468,10 @@ xxx
env.run_crons()
*_, pr2 = env['runbot_merge.pull_requests'].search([], order='number')
assert ('#%d' % pr.number) in pr2.message, \
"check that source / pr0 is referenced by resume PR"
assert ('#%d' % pr1.number) in pr2.message, \
"check that parent / pr1 is referenced by resume PR"
assert pr2.parent_id == pr1
assert pr2.source_id == pr0
assert re.match(