Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 39288:27946fca8a05
match: document that visitchildrenset might return files
At least when using includematcher, and probably most matchers, we do not know
if a/b/f refers to a file 'f' in a/b, or a subdirectory 'f' in a/b, so most
matchers will return {'f'} for visitchildrenset('a/b'). Arguably, all matchers
could/should - for exactmatcher, we know that 'f' is a file, but there's no
reason to return 'this' for visitchildrenset('a/b') causing code to investigate
'a/b/x', for example.
Differential Revision: https://phab.mercurial-scm.org/D4364
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 23 Aug 2018 18:04:15 -0700 |
parents | 0d032756e9bf |
children | 481db51c83e9 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Fri Aug 24 10:13:27 2018 -0700 +++ b/mercurial/dirstate.py Thu Aug 23 18:04:15 2018 -0700 @@ -912,11 +912,14 @@ continue raise for f, kind, st in entries: - # If we needed to inspect any files, visitentries would have - # been 'this' or 'all', and we would have set it to None - # above. If we have visitentries populated here, we don't - # care about any files in this directory, so no need to - # check the type of `f`. + # Some matchers may return files in the visitentries set, + # instead of 'this', if the matcher explicitly mentions them + # and is not an exactmatcher. This is acceptable; we do not + # make any hard assumptions about file-or-directory below + # based on the presence of `f` in visitentries. If + # visitchildrenset returned a set, we can always skip the + # entries *not* in the set it provided regardless of whether + # they're actually a file or a directory. if visitentries and f not in visitentries: continue if normalizefile: