mercurial/match.py
changeset 40242 19ed212de2d1
parent 39460 35ecaa999a12
child 40345 d30a19d10441
equal deleted inserted replaced
40241:81e4f039a0cd 40242:19ed212de2d1
  1162             return False
  1162             return False
  1163         matchfuncs.append(matchsubinclude)
  1163         matchfuncs.append(matchsubinclude)
  1164 
  1164 
  1165     regex = ''
  1165     regex = ''
  1166     if kindpats:
  1166     if kindpats:
  1167         regex, mf = _buildregexmatch(kindpats, globsuffix)
  1167         if all(k == 'rootfilesin' for k, p, s in kindpats):
  1168         matchfuncs.append(mf)
  1168             dirs = {p for k, p, s in kindpats}
       
  1169             def mf(f):
       
  1170                 i = f.rfind('/')
       
  1171                 if i >= 0:
       
  1172                     dir = f[:i]
       
  1173                 else:
       
  1174                     dir = '.'
       
  1175                 return dir in dirs
       
  1176             regex = b'rootfilesin: %s' % sorted(dirs)
       
  1177             matchfuncs.append(mf)
       
  1178         else:
       
  1179             regex, mf = _buildregexmatch(kindpats, globsuffix)
       
  1180             matchfuncs.append(mf)
  1169 
  1181 
  1170     if len(matchfuncs) == 1:
  1182     if len(matchfuncs) == 1:
  1171         return regex, matchfuncs[0]
  1183         return regex, matchfuncs[0]
  1172     else:
  1184     else:
  1173         return regex, lambda f: any(mf(f) for mf in matchfuncs)
  1185         return regex, lambda f: any(mf(f) for mf in matchfuncs)