comparison mercurial/dirstate.py @ 6048:cfb4a51da7d5

Merge with crew-stable
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Feb 2008 18:31:55 -0200
parents d0576d065993 a1ebd5cd7e55
children 218d5b9aa466
comparison
equal deleted inserted replaced
6047:a7178d4ed8ee 6048:cfb4a51da7d5
367 elif stat.S_ISDIR(mode): kind = _('directory') 367 elif stat.S_ISDIR(mode): kind = _('directory')
368 self._ui.warn(_('%s: unsupported file type (type is %s)\n') 368 self._ui.warn(_('%s: unsupported file type (type is %s)\n')
369 % (self.pathto(f), kind)) 369 % (self.pathto(f), kind))
370 return False 370 return False
371 371
372 def _dirignore(self, f):
373 if self._ignore(f):
374 return True
375 for c in strutil.findall(f, '/'):
376 if self._ignore(f[:c]):
377 return True
378 return False
379
372 def walk(self, files=None, match=util.always, badmatch=None): 380 def walk(self, files=None, match=util.always, badmatch=None):
373 # filter out the stat 381 # filter out the stat
374 for src, f, st in self.statwalk(files, match, badmatch=badmatch): 382 for src, f, st in self.statwalk(files, match, badmatch=badmatch):
375 yield src, f 383 yield src, f
376 384
402 if file_ not in dc and self._ignore(file_): 410 if file_ not in dc and self._ignore(file_):
403 return False 411 return False
404 return match(file_) 412 return match(file_)
405 413
406 ignore = self._ignore 414 ignore = self._ignore
415 dirignore = self._dirignore
407 if ignored: 416 if ignored:
408 imatch = match 417 imatch = match
409 ignore = util.never 418 ignore = util.never
419 dirignore = util.never
410 420
411 # self._root may end with a path separator when self._root == '/' 421 # self._root may end with a path separator when self._root == '/'
412 common_prefix_len = len(self._root) 422 common_prefix_len = len(self._root)
413 if not util.endswithsep(self._root): 423 if not util.endswithsep(self._root):
414 common_prefix_len += 1 424 common_prefix_len += 1
490 (self.pathto(ff), inst.strerror)) 500 (self.pathto(ff), inst.strerror))
491 elif badmatch and badmatch(ff) and imatch(nf): 501 elif badmatch and badmatch(ff) and imatch(nf):
492 yield 'b', ff, None 502 yield 'b', ff, None
493 continue 503 continue
494 if s_isdir(st.st_mode): 504 if s_isdir(st.st_mode):
495 for f, src, st in findfiles(f): 505 if not dirignore(nf):
496 yield src, f, st 506 for f, src, st in findfiles(f):
507 yield src, f, st
497 else: 508 else:
498 if nf in known: 509 if nf in known:
499 continue 510 continue
500 known[nf] = 1 511 known[nf] = 1
501 if match(nf): 512 if match(nf):
517 528
518 def status(self, files, match, list_ignored, list_clean): 529 def status(self, files, match, list_ignored, list_clean):
519 lookup, modified, added, unknown, ignored = [], [], [], [], [] 530 lookup, modified, added, unknown, ignored = [], [], [], [], []
520 removed, deleted, clean = [], [], [] 531 removed, deleted, clean = [], [], []
521 532
533 files = files or []
522 _join = self._join 534 _join = self._join
523 lstat = os.lstat 535 lstat = os.lstat
524 cmap = self._copymap 536 cmap = self._copymap
525 dmap = self._map 537 dmap = self._map
526 ladd = lookup.append 538 ladd = lookup.append
534 546
535 for src, fn, st in self.statwalk(files, match, ignored=list_ignored): 547 for src, fn, st in self.statwalk(files, match, ignored=list_ignored):
536 if fn in dmap: 548 if fn in dmap:
537 type_, mode, size, time, foo = dmap[fn] 549 type_, mode, size, time, foo = dmap[fn]
538 else: 550 else:
539 if list_ignored and self._ignore(fn): 551 if (list_ignored or fn in files) and self._dirignore(fn):
540 iadd(fn) 552 if list_ignored:
553 iadd(fn)
541 else: 554 else:
542 uadd(fn) 555 uadd(fn)
543 continue 556 continue
544 if src == 'm': 557 if src == 'm':
545 nonexistent = True 558 nonexistent = True