mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot_merge: move inconsistency block higher in batches
Should probably take priority over a PR being misconfigured.
This commit is contained in:
parent
2f3d03b0d9
commit
bca8adbdc4
@ -95,7 +95,7 @@ class Batch(models.Model):
|
|||||||
column_type=enum(_name, 'priority'),
|
column_type=enum(_name, 'priority'),
|
||||||
)
|
)
|
||||||
|
|
||||||
blocked = fields.Char(store=True, compute="_compute_stageable")
|
blocked = fields.Char(store=True, compute="_compute_blocked")
|
||||||
|
|
||||||
# unlike on PRs, this does not get detached... ? (because batches can be
|
# unlike on PRs, this does not get detached... ? (because batches can be
|
||||||
# partially detached so that's a PR-level concern)
|
# partially detached so that's a PR-level concern)
|
||||||
@ -199,12 +199,14 @@ class Batch(models.Model):
|
|||||||
"skipchecks",
|
"skipchecks",
|
||||||
"prs.status", "prs.reviewed_by", "prs.target",
|
"prs.status", "prs.reviewed_by", "prs.target",
|
||||||
)
|
)
|
||||||
def _compute_stageable(self):
|
def _compute_blocked(self):
|
||||||
for batch in self:
|
for batch in self:
|
||||||
if batch.merge_date:
|
if batch.merge_date:
|
||||||
batch.blocked = "Merged."
|
batch.blocked = "Merged."
|
||||||
elif not batch.active:
|
elif not batch.active:
|
||||||
batch.blocked = "all prs are closed"
|
batch.blocked = "all prs are closed"
|
||||||
|
elif len(targets := batch.prs.mapped('target')) > 1:
|
||||||
|
batch.blocked = f"Multiple target branches: {', '.join(targets.mapped('name'))!r}"
|
||||||
elif blocking := batch.prs.filtered(
|
elif blocking := batch.prs.filtered(
|
||||||
lambda p: p.error or p.draft or not (p.squash or p.merge_method)
|
lambda p: p.error or p.draft or not (p.squash or p.merge_method)
|
||||||
):
|
):
|
||||||
@ -220,8 +222,6 @@ class Batch(models.Model):
|
|||||||
unvalidated and f"{unvalidated} are waiting for CI",
|
unvalidated and f"{unvalidated} are waiting for CI",
|
||||||
failed and f"{failed} have failed CI",
|
failed and f"{failed} have failed CI",
|
||||||
]))
|
]))
|
||||||
elif len(targets := batch.prs.mapped('target')) > 1:
|
|
||||||
batch.blocked = f"Multiple target branches: {', '.join(targets.mapped('name'))!r}"
|
|
||||||
else:
|
else:
|
||||||
if batch.blocked and batch.cancel_staging:
|
if batch.blocked and batch.cancel_staging:
|
||||||
if splits := batch.target.split_ids:
|
if splits := batch.target.split_ids:
|
||||||
|
Loading…
Reference in New Issue
Block a user