diff --git a/runbot/models/branch.py b/runbot/models/branch.py index e3ce456a..52f0e488 100644 --- a/runbot/models/branch.py +++ b/runbot/models/branch.py @@ -6,7 +6,7 @@ from odoo import models, fields, api _logger = logging.getLogger(__name__) _re_coverage = re.compile(r'\bcoverage\b') - +_re_patch = re.compile(r'.*patch-\d+$') class runbot_branch(models.Model): @@ -72,8 +72,9 @@ class runbot_branch(models.Model): """compute pull head name""" for branch in self: pi = self._get_pull_info() - if pi: - branch.pull_head_name = pi['head']['ref'] + if pi and not _re_patch.match(pi['head']['label']): + # label is used to disambiguate PR with same branch name + branch.pull_head_name = pi['head']['label'] def _get_branch_quickconnect_url(self, fqdn, dest): self.ensure_one() diff --git a/runbot/models/build.py b/runbot/models/build.py index c1687495..24c02999 100644 --- a/runbot/models/build.py +++ b/runbot/models/build.py @@ -133,8 +133,7 @@ class runbot_build(models.Model): build = self branch, repo = build.branch_id, build.repo_id - pi = branch._get_pull_info() - name = pi['base']['ref'] if pi else branch.branch_name + name = branch.pull_head_name or branch.branch_name target_repo = self.env['runbot.repo'].browse(target_repo_id)