mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot_merge: status of closed PRs in extant batches
If a PR is closed but part of an ongoing batch, the change in status of the batch might be reflected on the PR still: - if a PR is closed and the batch gets staged, the PR shows up as being staged - if the PR is merged then the batch gets merged, the PR shows up as merged Fixes #914 Also remove the unused `_tagstate` helper property.
This commit is contained in:
parent
20a4e97b05
commit
5748c086e5
@ -431,10 +431,16 @@ class PullRequests(models.Model):
|
||||
staging_id = fields.Many2one('runbot_merge.stagings', compute='_compute_staging', inverse=readonly, readonly=True, store=True)
|
||||
staging_ids = fields.Many2many('runbot_merge.stagings', string="Stagings", compute='_compute_stagings', inverse=readonly, readonly=True, context={"active_test": False})
|
||||
|
||||
@api.depends('batch_id.batch_staging_ids.runbot_merge_stagings_id.active')
|
||||
@api.depends(
|
||||
'closed',
|
||||
'batch_id.batch_staging_ids.runbot_merge_stagings_id.active',
|
||||
)
|
||||
def _compute_staging(self):
|
||||
for p in self:
|
||||
p.staging_id = p.batch_id.staging_ids.filtered('active')
|
||||
if p.closed:
|
||||
p.staging_id = False
|
||||
else:
|
||||
p.staging_id = p.batch_id.staging_ids.filtered('active')
|
||||
|
||||
@api.depends('batch_id.batch_staging_ids.runbot_merge_stagings_id')
|
||||
def _compute_stagings(self):
|
||||
@ -1250,10 +1256,10 @@ For your own safety I've ignored *everything in your entire comment*.
|
||||
)
|
||||
def _compute_state(self):
|
||||
for pr in self:
|
||||
if pr.batch_id.merge_date:
|
||||
pr.state = 'merged'
|
||||
elif pr.closed:
|
||||
if pr.closed:
|
||||
pr.state = "closed"
|
||||
elif pr.batch_id.merge_date:
|
||||
pr.state = 'merged'
|
||||
elif pr.error:
|
||||
pr.state = "error"
|
||||
elif pr.batch_id.skipchecks: # skipchecks behaves as both approval and status override
|
||||
@ -1338,12 +1344,6 @@ For your own safety I've ignored *everything in your entire comment*.
|
||||
"ON runbot_merge_pull_requests "
|
||||
"USING hash (head)")
|
||||
|
||||
@property
|
||||
def _tagstate(self):
|
||||
if self.state == 'ready' and self.staging_id.heads:
|
||||
return 'staged'
|
||||
return self.state
|
||||
|
||||
def _get_batch(self, *, target, label):
|
||||
batch = self.env['runbot_merge.batch']
|
||||
if not re.search(r':patch-\d+$', label):
|
||||
|
Loading…
Reference in New Issue
Block a user