mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot_merge: convert staging.statuses to namedtuples
As they're mostly used in views after all, and views don't support tuple unpacking, having to index into a 4-uple is a bit of a pain.
This commit is contained in:
parent
f172dff6ab
commit
50568cfcc6
@ -22,6 +22,7 @@ import werkzeug
|
||||
from markupsafe import Markup
|
||||
|
||||
from odoo import api, fields, models, tools, Command
|
||||
from odoo.addons.base.controllers.rpc import OdooMarshaller
|
||||
from odoo.exceptions import AccessError, UserError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools import html_escape, Reverse, mute_logger
|
||||
@ -34,6 +35,10 @@ _logger = logging.getLogger(__name__)
|
||||
FOOTER = '\nMore info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port\n'
|
||||
|
||||
|
||||
Status = collections.namedtuple('Status', 'repository context state url')
|
||||
OdooMarshaller.dispatch[Status] = OdooMarshaller.dump_array
|
||||
|
||||
|
||||
class StatusConfiguration(models.Model):
|
||||
_name = 'runbot_merge.repository.status'
|
||||
_description = "required statuses on repositories"
|
||||
@ -2171,7 +2176,7 @@ class Stagings(models.Model):
|
||||
|
||||
commits = st.head_ids.with_prefetch(all_heads._prefetch_ids)
|
||||
st.statuses = [
|
||||
(
|
||||
Status(
|
||||
heads[commit].name,
|
||||
context,
|
||||
status.get('state') or 'pending',
|
||||
|
Loading…
Reference in New Issue
Block a user