|
33 | 33 | review_with_reviewer = 'r? @%s\n\n(rust-highfive has picked a reviewer for you, use r? to override)'
|
34 | 34 | review_without_reviewer = '@%s: no appropriate reviewer found, use r? to override'
|
35 | 35 |
|
36 |
| -reviewer_re = re.compile("\\b[rR]\?[:\- ]*@(?:([a-zA-Z0-9\-]+)/)?([a-zA-Z0-9\-]+)") |
| 36 | +reviewer_re = re.compile("\\b[rR]\?[:\- ]*@([a-zA-Z0-9\-]+)") |
| 37 | +reviewer_group_re = re.compile("\\b[rR]\?[:\- ]*@?(?:([a-zA-Z0-9\-]+)/)([a-zA-Z0-9\-]+)") |
37 | 38 | submodule_re = re.compile(".*\+Subproject\scommit\s.*", re.DOTALL | re.MULTILINE)
|
38 | 39 | target_re = re.compile("^[+-]{3} [ab]/compiler/rustc_target/src/spec/", re.MULTILINE)
|
39 | 40 |
|
@@ -248,22 +249,17 @@ def find_reviewer(self, msg, exclude):
|
248 | 249 | None.
|
249 | 250 | """
|
250 | 251 | if msg is not None:
|
| 252 | + match = reviewer_group_re.search(msg) |
| 253 | + if match: |
| 254 | + groups = self.get_groups() |
| 255 | + potential = groups.get(match.group(2)) or groups.get("%s/%s" % (match.group(1), match.group(2))) or [] |
| 256 | + potential.extend(groups["all"]) |
| 257 | + return self.pick_reviewer(groups, potential, exclude) |
| 258 | + |
251 | 259 | match = reviewer_re.search(msg)
|
252 | 260 | if match:
|
253 |
| - if match.group(1): |
254 |
| - # assign someone from the specified team |
255 |
| - groups = self.get_groups() |
256 |
| - potential = groups.get(match.group(2)) |
257 |
| - if potential is None: |
258 |
| - potential = groups.get("%s/%s" % (match.group(1), match.group(2))) |
259 |
| - if potential is None: |
260 |
| - potential = groups["all"] |
261 |
| - else: |
262 |
| - potential.extend(groups["all"]) |
263 |
| - |
264 |
| - return self.pick_reviewer(groups, potential, exclude) |
265 |
| - else: |
266 |
| - return match.group(2) |
| 261 | + return match.group(1) |
| 262 | + |
267 | 263 |
|
268 | 264 | def choose_reviewer(self, repo, owner, diff, exclude):
|
269 | 265 | """Choose a reviewer for the PR."""
|
|
0 commit comments