Patchwork D7150: dirstate: respect request to not list unknown/ignored/clean files (API)

login
register
mail settings
Submitter phabricator
Date Oct. 23, 2019, 6:49 a.m.
Message ID <differential-rev-PHID-DREV-7v7chlytdq3nb6jmfd74-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42536/
State New
Headers show

Comments

phabricator - Oct. 23, 2019, 6:49 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7150

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1137,16 +1137,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