From 30cfc4fe59fd60064f7a96aba85be360f9b9dea6 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 3 Aug 2021 14:14:44 +0200 Subject: [PATCH] [IMP] runbot_merge: disable active test on batch fields For post-mortem investigations and manipulations, they're inconvenient as the batches are deactivated on success and failure. --- forwardport/tests/test_weird.py | 2 +- runbot_merge/models/pull_requests.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/forwardport/tests/test_weird.py b/forwardport/tests/test_weird.py index 9cfa3ff5..e0c2fcd4 100644 --- a/forwardport/tests/test_weird.py +++ b/forwardport/tests/test_weird.py @@ -194,7 +194,7 @@ def test_failed_staging(env, config, make_repo): assert len(pr3_head) == 1 assert not pr3_id.batch_id, "check that the PR indeed has no batch anymore" - assert not pr3_id.batch_ids + assert not pr3_id.batch_ids.filtered(lambda b: b.active) assert len(env['runbot_merge.batch'].search([ ('prs', 'in', pr3_id.id), diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index c017c3c7..c58e3c34 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -705,7 +705,7 @@ class PullRequests(models.Model): previous_failure = fields.Char(default='{}') batch_id = fields.Many2one('runbot_merge.batch', string="Active Batch", compute='_compute_active_batch', store=True) - batch_ids = fields.Many2many('runbot_merge.batch', string="Batches") + batch_ids = fields.Many2many('runbot_merge.batch', string="Batches", context={'active_test': False}) staging_id = fields.Many2one(related='batch_id.staging_id', store=True) commits_map = fields.Char(help="JSON-encoded mapping of PR commits to actually integrated commits. The integration head (either a merge commit or the PR's topmost) is mapped from the 'empty' pr commit (the key is an empty string, because you can't put a null key in json maps).", default='{}') @@ -1642,6 +1642,7 @@ class Stagings(models.Model): batch_ids = fields.One2many( 'runbot_merge.batch', 'staging_id', + context={'active_test': False}, ) state = fields.Selection([ ('success', 'Success'),