##// END OF EJS Templates
match: document that visitchildrenset might return files...
Kyle Lippincott -
r39296:27946fca default
parent child Browse files
Show More
@@ -912,11 +912,14 b' class dirstate(object):'
912 continue
912 continue
913 raise
913 raise
914 for f, kind, st in entries:
914 for f, kind, st in entries:
915 # If we needed to inspect any files, visitentries would have
915 # Some matchers may return files in the visitentries set,
916 # been 'this' or 'all', and we would have set it to None
916 # instead of 'this', if the matcher explicitly mentions them
917 # above. If we have visitentries populated here, we don't
917 # and is not an exactmatcher. This is acceptable; we do not
918 # care about any files in this directory, so no need to
918 # make any hard assumptions about file-or-directory below
919 # check the type of `f`.
919 # based on the presence of `f` in visitentries. If
920 # visitchildrenset returned a set, we can always skip the
921 # entries *not* in the set it provided regardless of whether
922 # they're actually a file or a directory.
920 if visitentries and f not in visitentries:
923 if visitentries and f not in visitentries:
921 continue
924 continue
922 if normalizefile:
925 if normalizefile:
@@ -346,7 +346,7 b' class basematcher(object):'
346 ----------+-------------------
346 ----------+-------------------
347 False | set()
347 False | set()
348 'all' | 'all'
348 'all' | 'all'
349 True | 'this' OR non-empty set of subdirs to visit
349 True | 'this' OR non-empty set of subdirs -or files- to visit
350
350
351 Example:
351 Example:
352 Assume matchers ['path:foo/bar', 'rootfilesin:qux'], we would return
352 Assume matchers ['path:foo/bar', 'rootfilesin:qux'], we would return
@@ -357,10 +357,21 b' class basematcher(object):'
357 'baz' -> set()
357 'baz' -> set()
358 'foo' -> {'bar'}
358 'foo' -> {'bar'}
359 # Ideally this would be 'all', but since the prefix nature of matchers
359 # Ideally this would be 'all', but since the prefix nature of matchers
360 # is applied to the entire matcher, we have to downgrade to this
360 # is applied to the entire matcher, we have to downgrade this to
361 # 'this' due to the non-prefix 'rootfilesin'-kind matcher.
361 # 'this' due to the non-prefix 'rootfilesin'-kind matcher being mixed
362 # in.
362 'foo/bar' -> 'this'
363 'foo/bar' -> 'this'
363 'qux' -> 'this'
364 'qux' -> 'this'
365
366 Important:
367 Most matchers do not know if they're representing files or
368 directories. They see ['path:dir/f'] and don't know whether 'f' is a
369 file or a directory, so visitchildrenset('dir') for most matchers will
370 return {'f'}, but if the matcher knows it's a file (like exactmatcher
371 does), it may return 'this'. Do not rely on the return being a set
372 indicating that there are no files in this dir to investigate (or
373 equivalently that if there are files to investigate in 'dir' that it
374 will always return 'this').
364 '''
375 '''
365 return 'this'
376 return 'this'
366
377
General Comments 0
You need to be logged in to leave comments. Login now