diff --git a/runbot/__manifest__.py b/runbot/__manifest__.py index 1288b4b3..8cec3007 100644 --- a/runbot/__manifest__.py +++ b/runbot/__manifest__.py @@ -6,7 +6,7 @@ 'author': "Odoo SA", 'website': "http://runbot.odoo.com", 'category': 'Website', - 'version': '5.6', + 'version': '5.7', 'application': True, 'depends': ['base', 'base_automation', 'website'], 'data': [ diff --git a/runbot/migrations/17.0.5.7/pre-migration.py b/runbot/migrations/17.0.5.7/pre-migration.py new file mode 100644 index 00000000..b85a8408 --- /dev/null +++ b/runbot/migrations/17.0.5.7/pre-migration.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +import logging + + +def migrate(cr, version): + cr.execute('ALTER TABLE runbot_commit_link ADD COLUMN repo_id INT') + cr.execute('ALTER TABLE runbot_commit_link ADD COLUMN sequence INT') + cr.execute(''' + UPDATE runbot_commit_link + SET repo_id=commit.repo_id, sequence = repo.sequence + FROM runbot_commit commit + JOIN runbot_repo repo ON commit.repo_id=repo.id + WHERE commit.id = runbot_commit_link.commit_id + ''') diff --git a/runbot/models/commit.py b/runbot/models/commit.py index 95886d7d..b74b5e04 100644 --- a/runbot/models/commit.py +++ b/runbot/models/commit.py @@ -195,12 +195,16 @@ class Commit(models.Model): class CommitLink(models.Model): _name = 'runbot.commit.link' _description = "Build commit" + _order = 'sequence,repo_id,id' commit_id = fields.Many2one('runbot.commit', 'Commit', required=True, index=True) # Link info match_type = fields.Selection([('new', 'New head of branch'), ('head', 'Head of branch'), ('base_head', 'Found on base branch'), ('base_match', 'Found on base branch')]) # HEAD, DEFAULT branch_id = fields.Many2one('runbot.branch', string='Found in branch') # Shouldn't be use for anything else than display + repo_id = fields.Many2one('runbot.repo', related='commit_id.repo_id', store=True) + sequence = fields.Integer('runbot.repo', related='commit_id.repo_id.sequence', store=True) + base_commit_id = fields.Many2one('runbot.commit', 'Base head commit', index=True) merge_base_commit_id = fields.Many2one('runbot.commit', 'Merge Base commit', index=True) base_behind = fields.Integer('# commits behind base') diff --git a/runbot/tests/test_upgrade.py b/runbot/tests/test_upgrade.py index 67e8e49f..06b3b84f 100644 --- a/runbot/tests/test_upgrade.py +++ b/runbot/tests/test_upgrade.py @@ -461,8 +461,8 @@ class TestUpgradeFlow(RunbotCase): self.assertTrue(ro_volumes.pop(f'/home/{user}/.odoorc').startswith(self.env['runbot.runbot']._path('build'))) self.assertEqual( list(ro_volumes.keys()), [ - '/data/build/addons', '/data/build/server', + '/data/build/addons', '/data/build/upgrade', ], "other commit should have been added automaticaly" @@ -470,7 +470,7 @@ class TestUpgradeFlow(RunbotCase): self.assertEqual( str(cmd), 'python3 server/server.py {addons_path} --no-xmlrpcs --no-netrpc -u all -d {db_name} --stop-after-init --max-cron-threads=0'.format( - addons_path='--addons-path addons,server/addons,server/core/addons', + addons_path='--addons-path server/addons,server/core/addons,addons', db_name=f'{current_build.dest}-{suffix}') ) self.patchers['docker_run'].side_effect = docker_run_upgrade