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:
parent
1fa7e4c0c7
commit
c9c31f843c
runbot
@ -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)):
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user