@@ -315,39 +315,39 @@ def get_to_mention(self, diff, author):
315315 """
316316 Get the list of people to mention.
317317 """
318- dirs = self .repo_config .get ('dirs' , {})
319318 mentions = self .repo_config .get ('mentions' , {})
319+ if not mentions :
320+ return []
320321
321322 to_mention = set ()
322323 # If there's directories with specially assigned groups/users
323324 # inspect the diff to find the directory with the most additions
324- if dirs :
325- cur_dir = None
326- for line in diff .split ('\n ' ):
327- if line .startswith ("diff --git " ):
328- # update cur_dir
329- cur_dir = None
330- parts = line [line .find (" b/" ) + len (" b/" ):].split ("/" )
331- if not parts :
332- continue
333- cur_dir = "/" .join (parts [:2 ])
334- full_dir = "/" .join (parts )
325+ cur_dir = None
326+ for line in diff .split ('\n ' ):
327+ if line .startswith ("diff --git " ):
328+ # update cur_dir
329+ cur_dir = None
330+ parts = line [line .find (" b/" ) + len (" b/" ):].split ("/" )
331+ if not parts :
332+ continue
333+ cur_dir = "/" .join (parts [:2 ])
334+ full_dir = "/" .join (parts )
335335
336- # A few heuristics to get better reviewers
337- if cur_dir .startswith ('src/librustc' ):
338- cur_dir = 'src/librustc'
339- if cur_dir == 'src/test' :
340- cur_dir = None
341- if len (full_dir ) > 0 :
342- for entry in mentions :
343- # Check if this entry is a prefix
344- eparts = entry .split ("/" )
345- if (len (eparts ) <= len (parts ) and
346- all (a == b for a ,b in zip (parts , eparts ))
347- ):
348- to_mention .add (entry )
349- elif entry .endswith ('.rs' ) and full_dir .endswith (entry ):
350- to_mention .add (entry )
336+ # A few heuristics to get better reviewers
337+ if cur_dir .startswith ('src/librustc' ):
338+ cur_dir = 'src/librustc'
339+ if cur_dir == 'src/test' :
340+ cur_dir = None
341+ if len (full_dir ) > 0 :
342+ for entry in mentions :
343+ # Check if this entry is a prefix
344+ eparts = entry .split ("/" )
345+ if (len (eparts ) <= len (parts ) and
346+ all (a == b for a ,b in zip (parts , eparts ))
347+ ):
348+ to_mention .add (entry )
349+ elif entry .endswith ('.rs' ) and full_dir .endswith (entry ):
350+ to_mention .add (entry )
351351
352352 mention_list = []
353353 for mention in to_mention :
0 commit comments