From 134ce03053ee917208cfefa145f4cdda9597a15c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 31 Oct 2023 07:36:10 +0100 Subject: [PATCH] [FIX] forwardport: fix sourcing on reparenting When reparenting a commit (mostly when inserting a new forwardport in an existing chain after a freeze / branch insertion), the new source should be the source of the new parent (which is likely a not-change of the source). This was miscomputed to the root of the new parent, which often matches but breaks if there was a conflict or a mid-port update, leading to inconsistent presentation. Nothing critical, just somewhat annoying. --- forwardport/models/project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/forwardport/models/project.py b/forwardport/models/project.py index adde4192..ff977628 100644 --- a/forwardport/models/project.py +++ b/forwardport/models/project.py @@ -348,7 +348,8 @@ class PullRequests(models.Model): }) if vals.get('parent_id') and 'source_id' not in vals: - vals['source_id'] = self.browse(vals['parent_id']).root_id.id + parent = self.browse(vals['parent_id']) + vals['source_id'] = (parent.source_id or parent).id if vals.get('state') == 'merged': vals['merge_date'] = fields.Datetime.now() r = super().write(vals)