mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot_merge: cancel splits on cancel=staging
If a PR is cancel=staging, even if it's not the urgentest (priority=alone) odds are good it's being staged to fix the split. And even if it's not, it probably can't hurt. So cancel splits in order to stage it. This may be slightly harmful if the split is legit and has nothing to do with the PR being prioritised, but that seems like the less likely scenario. And having to update staging priorities on the fly seems like a bad idea. Though obviously it might do nothing if the PRs are in "default" priority.# Also simplify the unstage trigger from the PRs becoming ready: - the user is useless as it's always the system user - the batch id is not really helpful
This commit is contained in:
parent
3bc5b4e3e4
commit
1c76a675c2
@ -227,10 +227,10 @@ class Batch(models.Model):
|
||||
batch.blocked = f"Multiple target branches: {', '.join(targets.mapped('name'))!r}"
|
||||
else:
|
||||
if batch.blocked and batch.cancel_staging:
|
||||
if splits := batch.target.split_ids:
|
||||
splits.unlink()
|
||||
batch.target.active_staging_id.cancel(
|
||||
'unstaged by %s on %s (%s)',
|
||||
self.env.user.login,
|
||||
batch,
|
||||
'unstaged by %s becoming ready',
|
||||
', '.join(batch.prs.mapped('display_name')),
|
||||
)
|
||||
batch.blocked = False
|
||||
|
@ -842,6 +842,8 @@ For your own safety I've ignored *everything in your entire comment*.
|
||||
case commands.CancelStaging() if is_admin:
|
||||
self.batch_id.cancel_staging = True
|
||||
if not self.batch_id.blocked:
|
||||
if splits := self.target.split_ids:
|
||||
splits.unlink()
|
||||
self.target.active_staging_id.cancel(
|
||||
"Unstaged by %s on %s",
|
||||
author.github_login, self.display_name,
|
||||
|
Loading…
Reference in New Issue
Block a user