##// END OF EJS Templates
reviewers: fixed logic with wildcard match for branches.
marcink -
r2574:db47ef34 default
parent child Browse files
Show More
@@ -4224,7 +4224,8 b' class RepoReviewRule(Base, BaseModel):'
4224 4224 """
4225 4225 Check if this review rule matches a branch/files in a pull request
4226 4226
4227 :param branch: branch name for the commit
4227 :param source_branch: source branch name for the commit
4228 :param target_branch: target branch name for the commit
4228 4229 :param files_changed: list of file paths changed in the pull request
4229 4230 """
4230 4231
@@ -4234,15 +4235,20 b' class RepoReviewRule(Base, BaseModel):'
4234 4235
4235 4236 branch_matches = True
4236 4237 if source_branch or target_branch:
4237 source_branch_regex = re.compile(
4238 '^' + glob2re(self.source_branch_pattern) + '$')
4239 target_branch_regex = re.compile(
4240 '^' + glob2re(self.target_branch_pattern) + '$')
4241
4242 branch_matches = (
4243 bool(source_branch_regex.search(source_branch)) and
4244 bool(target_branch_regex.search(target_branch))
4245 )
4238 if self.source_branch_pattern == '*':
4239 source_branch_match = True
4240 else:
4241 source_branch_regex = re.compile(
4242 '^' + glob2re(self.source_branch_pattern) + '$')
4243 source_branch_match = bool(source_branch_regex.search(source_branch))
4244 if self.target_branch_pattern == '*':
4245 target_branch_match = True
4246 else:
4247 target_branch_regex = re.compile(
4248 '^' + glob2re(self.target_branch_pattern) + '$')
4249 target_branch_match = bool(target_branch_regex.search(target_branch))
4250
4251 branch_matches = source_branch_match and target_branch_match
4246 4252
4247 4253 files_matches = True
4248 4254 if self.file_pattern != '*':
General Comments 0
You need to be logged in to leave comments. Login now