Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] runbot: fix branch search #1016

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Conversation

Williambraecky
Copy link
Contributor

Allows searching branch through pr url or full branch name. Also fixes a crash when searching invalid values.

@C3POdoo C3POdoo requested a review from a team December 12, 2024 10:02
return ['&', ('remote_id', '=', self.env['runbot.remote'].search([('owner', '=', owner), ('repo_name', '=', repo_name)]).id), ('name', operator, branch_name)]
# Match format (owner?, repo, branch)
owner = repo = branch = None
if (m := re.match(r'(?:([\w-]+)/)?([\w-]+):([\w-]+)', value)):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (m := re.match(r'(?:([\w-]+)/)?([\w-]+):([\w-]+)', value)):
if (m := re.match(r'(?:([\w-]+)/)?([\w-]+):([\w\.-]+)', value)):

Branch names may contains . otherwise, searching for a branch with odoo:17.0-fix-too will lead to a ilike %17%

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 😄

@Williambraecky Williambraecky force-pushed the 18.0-fix-branch-dname-search-wbr branch from d4fd0a6 to fae4957 Compare January 15, 2025 14:40
@Williambraecky
Copy link
Contributor Author

@d-fence I also added tests to match the new behavior :)

Allows searching branch through pr url or full branch name.
Also fixes a crash when searching invalid values.
@Williambraecky Williambraecky force-pushed the 18.0-fix-branch-dname-search-wbr branch from fae4957 to f95c2be Compare January 15, 2025 14:47
@d-fence d-fence merged commit 1add8d5 into 18.0 Jan 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants