5
0
mirror of https://github.com/odoo/runbot.git synced 2025-03-16 07:55:45 +07:00

[IMP] runbot: support github display for branch search

Supports the format (?owner)/repo#id in the `_search_dname` method.
This commit is contained in:
William Braeckman 2025-01-22 15:25:14 +01:00 committed by William Braeckman (wbr)
parent 1fa7e4c0c7
commit c9c31f843c
2 changed files with 5 additions and 1 deletions
runbot

View File

@ -51,7 +51,7 @@ class Branch(models.Model):
def _search_dname(self, operator, value):
# Match format (owner?, repo, branch)
owner = repo = branch = None
if (m := re.match(r'(?:([\w-]+)/)?([\w-]+):([\w\.-]+)', value)):
if (m := re.match(r'(?:([\w-]+)/)?([\w-]+)[:#]([\w\.-]+)', value)):
owner, repo, branch = m.groups()
# Match PR url format
if (m := re.search(r'/([\w-]+)/([\w-]+)/pull/(\d+)', value)):

View File

@ -35,6 +35,10 @@ class TestBranch(RunbotCase):
self.branch_server,
self.Branch.search([('dname', '=', self.branch_server.dname)]),
)
self.assertEqual(
self.branch_server,
self.Branch.search([('dname', '=', self.branch_server.dname.replace(':', '#'))]),
)
# Basic pr
self.assertEqual(
self.dev_pr,