##// END OF EJS Templates
dirstate.walk: eliminate filter function...
Matt Mackall -
r6819:78624d74 default
parent child Browse files
Show More
@@ -401,35 +401,6 b' class dirstate(object):'
401 st.rename()
401 st.rename()
402 self._dirty = self._dirtypl = False
402 self._dirty = self._dirtypl = False
403
403
404 def _filter(self, files):
405 ret = {}
406 unknown = []
407
408 for x in files:
409 if x == '.':
410 return self._map.copy()
411 if x not in self._map:
412 unknown.append(x)
413 else:
414 ret[x] = self._map[x]
415
416 if not unknown:
417 return ret
418
419 b = util.sort(self._map)
420 blen = len(b)
421
422 for x in unknown:
423 bs = bisect.bisect(b, "%s%s" % (x, '/'))
424 while bs < blen:
425 s = b[bs]
426 if len(s) > len(x) and s.startswith(x):
427 ret[s] = self._map[s]
428 else:
429 break
430 bs += 1
431 return ret
432
433 def _supported(self, f, mode, verbose=False):
404 def _supported(self, f, mode, verbose=False):
434 if stat.S_ISREG(mode) or stat.S_ISLNK(mode):
405 if stat.S_ISREG(mode) or stat.S_ISLNK(mode):
435 return True
406 return True
@@ -470,14 +441,10 b' class dirstate(object):'
470 if hasattr(match, 'bad'):
441 if hasattr(match, 'bad'):
471 badfn = match.bad
442 badfn = match.bad
472
443
473 # walk all files by default
444 files = util.unique(match.files())
474 files = match.files()
445 if not files or '.' in files:
475 if not files:
446 files = ['']
476 files = ['.']
447 dc = self._map
477 dc = self._map.copy()
478 else:
479 files = util.unique(files)
480 dc = self._filter(files)
481
448
482 def imatch(file_):
449 def imatch(file_):
483 if file_ not in dc and self._ignore(file_):
450 if file_ not in dc and self._ignore(file_):
@@ -582,19 +549,17 b' class dirstate(object):'
582 if nn in known:
549 if nn in known:
583 continue
550 continue
584 known[nn] = 1
551 known[nn] = 1
585 if match(nf):
586 if supported(ff, st.st_mode, verbose=True):
552 if supported(ff, st.st_mode, verbose=True):
587 yield nn, st
553 yield self.normalize(nf), st
588 elif ff in dc:
554 elif ff in dc:
589 yield nf, None
555 yield nf, None
590
556
591 # step two run through anything left in the dc hash and yield
557 # step two run through anything left in the dc hash and yield
592 # if we haven't already seen it
558 # if we haven't already seen it
593 for f in util.sort(dc):
559 for f in util.sort(dc):
594 if f in known:
560 if f in known or not match(f):
595 continue
561 continue
596 known[f] = 1
562 known[f] = 1
597 if imatch(f):
598 try:
563 try:
599 st = lstat(_join(f))
564 st = lstat(_join(f))
600 if supported(f, st.st_mode):
565 if supported(f, st.st_mode):
General Comments 0
You need to be logged in to leave comments. Login now