[FIX] runbot_merge: make staging serialization more useful

Having the staged and merged heads via an easy to reach endpoint is
nice, but having *just* the hashes is not as it requires basically
exhaustively checking commits against repos to see which is
where. That's annoying.

Make the head serializations a map of repository to commit
hash. That's a lot more convenient.
This commit is contained in:
Xavier Morel 2025-01-20 15:47:45 +01:00
parent f900eb68b6
commit f3dd3e6fde

View File

@ -27,8 +27,14 @@ def staging_dict(staging):
'repository': p.repository.name,
'number': p.number,
}),
'merged': staging.commit_ids.mapped('sha'),
'staged': staging.head_ids.mapped('sha'),
'merged': {
c.repository_id.name: c.commit_id.sha
for c in staging.commits
},
'staged': {
h.repository_id.name: h.commit_id.sha
for h in staging.heads
},
}
class MergebotController(Controller):