[IMP] runbot_merge: show heads on stagings

Stagings have a "statuses" field which was shown but useless (as it's
a binary), they also have a "heads" field which only provides a
mapping of repository names to commits.

This change provides the staging heads as a commits m2m.

Fixes #178
This commit is contained in:
Xavier Morel 2019-08-26 16:25:16 +02:00
parent 1981bd68e6
commit e40e814b90
2 changed files with 12 additions and 4 deletions

View File

@ -1265,6 +1265,7 @@ class Stagings(models.Model):
# seems simpler than adding yet another indirection through a model
heads = fields.Char(required=True, help="JSON-encoded map of heads, one per repo in the project")
head_ids = fields.Many2many('runbot_merge.commit', compute='_compute_statuses')
statuses = fields.Binary(compute='_compute_statuses')
@ -1279,7 +1280,7 @@ class Stagings(models.Model):
head: repo for repo, head in json.loads(st.heads).items()
if not repo.endswith('^')
}
commits = Commits.search([('sha', 'in', list(heads.keys()))])
commits = st.head_ids = Commits.search([('sha', 'in', list(heads.keys()))])
st.statuses = [
(
heads[commit.sha],

View File

@ -201,11 +201,18 @@
</group>
<group>
<field name="staged_at"/>
<field name="statuses"/>
</group>
</group>
<group>
<field name="batch_ids" colspan="4">
<group string="Heads">
<field name="head_ids" colspan="4" nolabel="1">
<tree>
<field name="sha"/>
<field name="statuses"/>
</tree>
</field>
</group>
<group string="Batches">
<field name="batch_ids" colspan="4" nolabel="1">
<tree>
<field name="prs"/>
</tree>