Show More
@@ -4210,7 +4210,8 b' class RepoReviewRule(Base, BaseModel):' | |||||
4210 | """ |
|
4210 | """ | |
4211 | Check if this review rule matches a branch/files in a pull request |
|
4211 | Check if this review rule matches a branch/files in a pull request | |
4212 |
|
4212 | |||
4213 | :param branch: branch name for the commit |
|
4213 | :param source_branch: source branch name for the commit | |
|
4214 | :param target_branch: target branch name for the commit | |||
4214 | :param files_changed: list of file paths changed in the pull request |
|
4215 | :param files_changed: list of file paths changed in the pull request | |
4215 | """ |
|
4216 | """ | |
4216 |
|
4217 | |||
@@ -4220,15 +4221,20 b' class RepoReviewRule(Base, BaseModel):' | |||||
4220 |
|
4221 | |||
4221 | branch_matches = True |
|
4222 | branch_matches = True | |
4222 | if source_branch or target_branch: |
|
4223 | if source_branch or target_branch: | |
|
4224 | if self.source_branch_pattern == '*': | |||
|
4225 | source_branch_match = True | |||
|
4226 | else: | |||
4223 | source_branch_regex = re.compile( |
|
4227 | source_branch_regex = re.compile( | |
4224 | '^' + glob2re(self.source_branch_pattern) + '$') |
|
4228 | '^' + glob2re(self.source_branch_pattern) + '$') | |
|
4229 | source_branch_match = bool(source_branch_regex.search(source_branch)) | |||
|
4230 | if self.target_branch_pattern == '*': | |||
|
4231 | target_branch_match = True | |||
|
4232 | else: | |||
4225 | target_branch_regex = re.compile( |
|
4233 | target_branch_regex = re.compile( | |
4226 | '^' + glob2re(self.target_branch_pattern) + '$') |
|
4234 | '^' + glob2re(self.target_branch_pattern) + '$') | |
4227 |
|
4235 | target_branch_match = bool(target_branch_regex.search(target_branch)) | ||
4228 | branch_matches = ( |
|
4236 | ||
4229 | bool(source_branch_regex.search(source_branch)) and |
|
4237 | branch_matches = source_branch_match and target_branch_match | |
4230 | bool(target_branch_regex.search(target_branch)) |
|
|||
4231 | ) |
|
|||
4232 |
|
4238 | |||
4233 | files_matches = True |
|
4239 | files_matches = True | |
4234 | if self.file_pattern != '*': |
|
4240 | if self.file_pattern != '*': |
General Comments 0
You need to be logged in to leave comments.
Login now