--- a/mercurial/dirstate.py Fri Feb 08 13:16:49 2008 -0200
+++ b/mercurial/dirstate.py Fri Feb 08 18:31:55 2008 -0200
@@ -369,6 +369,14 @@
% (self.pathto(f), kind))
return False
+ def _dirignore(self, f):
+ if self._ignore(f):
+ return True
+ for c in strutil.findall(f, '/'):
+ if self._ignore(f[:c]):
+ return True
+ return False
+
def walk(self, files=None, match=util.always, badmatch=None):
# filter out the stat
for src, f, st in self.statwalk(files, match, badmatch=badmatch):
@@ -404,9 +412,11 @@
return match(file_)
ignore = self._ignore
+ dirignore = self._dirignore
if ignored:
imatch = match
ignore = util.never
+ dirignore = util.never
# self._root may end with a path separator when self._root == '/'
common_prefix_len = len(self._root)
@@ -492,8 +502,9 @@
yield 'b', ff, None
continue
if s_isdir(st.st_mode):
- for f, src, st in findfiles(f):
- yield src, f, st
+ if not dirignore(nf):
+ for f, src, st in findfiles(f):
+ yield src, f, st
else:
if nf in known:
continue
@@ -519,6 +530,7 @@
lookup, modified, added, unknown, ignored = [], [], [], [], []
removed, deleted, clean = [], [], []
+ files = files or []
_join = self._join
lstat = os.lstat
cmap = self._copymap
@@ -536,8 +548,9 @@
if fn in dmap:
type_, mode, size, time, foo = dmap[fn]
else:
- if list_ignored and self._ignore(fn):
- iadd(fn)
+ if (list_ignored or fn in files) and self._dirignore(fn):
+ if list_ignored:
+ iadd(fn)
else:
uadd(fn)
continue