comparison mercurial/dirstate.py @ 4188:dd0d9bd91e0a

dirstate.statwalk: explicitly test for ignored directories This removes a hack where we appended '/' to a dirname so that: - it would not appear on the "dc" dict - it would always be matched by the match function This was a contorted way of checking if the directory was matched by some hgignore pattern, and it would still fail with some uses of --include/--exclude patterns. Things would still work fine if we removed the check altogether and just appended things to "work" directly, but then we would end up walking ignored directories too, which could be quite a bit of work. This allows further simplification of the match function returned by util._matcher, and fixes walking the working directory with a --include pattern that matches only the end of a name.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 10 Mar 2007 23:00:54 -0300
parents b36bd7534c08
children b5d1eaade333 a7cae4e22749
comparison
equal deleted inserted replaced
4187:9814d600011e 4188:dd0d9bd91e0a
385 def imatch(file_): 385 def imatch(file_):
386 if file_ not in dc and self.ignore(file_): 386 if file_ not in dc and self.ignore(file_):
387 return False 387 return False
388 return match(file_) 388 return match(file_)
389 389
390 if ignored: imatch = match 390 ignore = self.ignore
391 if ignored:
392 imatch = match
393 ignore = util.never
391 394
392 # self.root may end with a path separator when self.root == '/' 395 # self.root may end with a path separator when self.root == '/'
393 common_prefix_len = len(self.root) 396 common_prefix_len = len(self.root)
394 if not self.root.endswith(os.sep): 397 if not self.root.endswith(os.sep):
395 common_prefix_len += 1 398 common_prefix_len += 1
418 continue 421 continue
419 p = os.path.join(top, f) 422 p = os.path.join(top, f)
420 # don't trip over symlinks 423 # don't trip over symlinks
421 st = os.lstat(p) 424 st = os.lstat(p)
422 if stat.S_ISDIR(st.st_mode): 425 if stat.S_ISDIR(st.st_mode):
423 ds = util.pconvert(os.path.join(nd, f +'/')) 426 if not ignore(p):
424 if imatch(ds):
425 work.append(p) 427 work.append(p)
426 if imatch(np) and np in dc: 428 if imatch(np) and np in dc:
427 yield 'm', np, st 429 yield 'm', np, st
428 elif imatch(np): 430 elif imatch(np):
429 if self.supported_type(np, st): 431 if self.supported_type(np, st):