From patchwork Wed Oct 23 06:49:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7150: dirstate: respect request to not list unknown/ignored/clean files (API) From: phabricator X-Patchwork-Id: 42536 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 23 Oct 2019 06:49:36 +0000 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 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