comparison mercurial/dirstate.py @ 2486:3ea8111ead90

simplify filterfiles when filtering based on a directory since an unkown files cannot be an exact match, we bisect for a <path>/ instead of <path> and we get only the files below the directory.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 23 Jun 2006 08:09:48 +0200
parents 885de96eb542
children 5c10b7ed3411 e196aa1df169
comparison
equal deleted inserted replaced
2485:885de96eb542 2486:3ea8111ead90
277 b = self.map.keys() 277 b = self.map.keys()
278 b.sort() 278 b.sort()
279 blen = len(b) 279 blen = len(b)
280 280
281 for x in unknown: 281 for x in unknown:
282 bs = bisect.bisect(b, x) 282 bs = bisect.bisect(b, "%s%s" % (x, '/'))
283 if bs != 0 and b[bs-1] == x:
284 ret[x] = self.map[x]
285 continue
286 while bs < blen: 283 while bs < blen:
287 s = b[bs] 284 s = b[bs]
288 if len(s) > len(x) and s.startswith(x): 285 if len(s) > len(x) and s.startswith(x):
289 if s[len(x)] == '/': 286 ret[s] = self.map[s]
290 ret[s] = self.map[s]
291 else: 287 else:
292 break 288 break
293 bs += 1 289 bs += 1
294 return ret 290 return ret
295 291