From d751cf46a08b5ea4344f5e31f7dbf5d0c78e02b6 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 12 Jan 2021 12:54:35 +0100 Subject: [PATCH] [IMP] forwardport: add logging to branch reinsertion When a new branch is created between other branches, the process to try and look for forward-port PRs to create to "fill in" currently has no logging so it's very difficult to figure out why it decides not to do something. Add some logging to the process to try and better understand what happens. Fixes #441 --- forwardport/models/project.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/forwardport/models/project.py b/forwardport/models/project.py index 767b09bf..315e33e3 100644 --- a/forwardport/models/project.py +++ b/forwardport/models/project.py @@ -99,6 +99,9 @@ class Project(models.Model): bafter = p._forward_port_ordered() if bafter.ids == bbefore.ids: continue + + logger = _logger.getChild('project').getChild(p.name) + logger.debug("branches updated %s -> %s", bbefore, bafter) # if it's just that a branch was inserted at the end forwardport # should keep on keeping normally if bafter.ids[:-1] == bbefore.ids: @@ -120,6 +123,7 @@ class Project(models.Model): if new: raise UserError("Inserting multiple branches at the same time is not supported") new = b + logger.debug('before: %s new: %s after: %s', before.ids, new.ids, after.ids) # find all FPs whose ancestry spans the insertion leaves = self.env['runbot_merge.pull_requests'].search([ ('state', 'not in', ['closed', 'merged']), @@ -133,6 +137,7 @@ class Project(models.Model): '|', ('id', 'in', leaves.mapped('source_id').ids), ('source_id', 'in', leaves.mapped('source_id').ids), ]) + logger.debug("\nPRs spanning new: %s\nto port: %s", leaves, candidates) # enqueue the creation of a new forward-port based on our candidates # but it should only create a single step and needs to stitch batch # the parents linked list, so it has a special type