[FIX] forwardport: completely update PR data when forwarding updates

The process did properly update the state, but not the squash state.

It's somewhat unclear whether the state should be fully reset and
require reapproval though. Maybe only the validation should be reset?
The CI will eventually run and either succeed (re-validating) or
fail (devalidating, hopefully) but I'm not entirely sure this is
correct.
This commit is contained in:
Xavier Morel 2021-02-26 09:45:44 +01:00
parent a541781ee0
commit 2aeecb68b9

View File

@ -117,8 +117,16 @@ class UpdateQueue(models.Model, Queue):
child.target, child.refname, s)
new_head = working_copy.stdout().rev_parse(child.refname).stdout.decode().strip()
commits_count = int(working_copy.stdout().rev_list(
f'{child.target.name}..{child.refname}',
count=True
).stdout.decode().strip())
# update child's head to the head we're going to push
child.with_context(ignore_head_update=True).head = new_head
child.with_context(ignore_head_update=True).write({
'head': new_head,
# 'state': 'opened',
'squash': commits_count == 1,
})
working_copy.push('-f', 'target', child.refname)
# committing here means github could technically trigger its
# webhook before sending a response, but committing before