dirstate: respect request to not list unknown/ignored/clean files (API)
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 22 Oct 2019 23:21:26 -0700
changeset 43664 dd773340a085
parent 43663 c207c46a86b9
child 43665 975e517451a6
dirstate: respect request to not list unknown/ignored/clean files (API) Unknown files that are explicitly mentioned by the matcher are returned even if the caller said unknown=False (and it seems the same is done for ignored files). That seems pretty surprising. Let's make the interface less surprising by respecting the caller's request. Differential Revision: https://phab.mercurial-scm.org/D7150
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Wed Nov 13 09:09:42 2019 +0100
+++ b/mercurial/dirstate.py	Tue Oct 22 23:21:26 2019 -0700
@@ -1149,16 +1149,19 @@
             )
             return (lookup, status)
 
+        def noop(f):
+            pass
+
         dcontains = dmap.__contains__
         dget = dmap.__getitem__
         ladd = lookup.append  # aka "unsure"
         madd = modified.append
         aadd = added.append
-        uadd = unknown.append
-        iadd = ignored.append
+        uadd = unknown.append if listunknown else noop
+        iadd = ignored.append if listignored else noop
         radd = removed.append
         dadd = deleted.append
-        cadd = clean.append
+        cadd = clean.append if listclean else noop
         mexact = match.exact
         dirignore = self._dirignore
         checkexec = self._checkexec