From 955b97a023187fb1eae4cab38dd8edf8729aaf32 Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Wed, 31 Jul 2019 09:19:28 +0200 Subject: [PATCH] [IMP] runbot_merge: p=1 > split Allows merging a fix for e.g. a common false positive during a split but without cancelling a staging which might just pass (you never know). --- runbot_merge/models/pull_requests.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 33f0636e..ddbc2b8e 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -316,18 +316,21 @@ class Branch(models.Model): rows = self._stageable() priority = rows[0][0] if rows else -1 - if priority == 0: + if priority == 0 or priority == 1: # p=0 take precedence over all else + # p=1 allows merging a fix inside / ahead of a split (e.g. branch + # is broken or widespread false positive) without having to cancel + # the existing staging batched_prs = [PRs.browse(pr_ids) for _, pr_ids in takewhile(lambda r: r[0] == priority, rows)] elif self.split_ids: split_ids = self.split_ids[0] logger.info("Found split of PRs %s, re-staging", split_ids.mapped('batch_ids.prs')) batched_prs = [batch.prs for batch in split_ids.batch_ids] split_ids.unlink() - elif rows: - # p=1 or p=2 + else: # p=2 batched_prs = [PRs.browse(pr_ids) for _, pr_ids in takewhile(lambda r: r[0] == priority, rows)] - else: + + if not batched_prs: return Batch = self.env['runbot_merge.batch']