Mercurial > hg
diff mercurial/dirstate.py @ 49355:0540c1628fd4
sparse: use None as the sparse matcher value when disabled
This create a clear signal for when the feature is unused. We could also create
an `alwaysmatcher`, but using None is more explicit, so I went for it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 11 Jun 2022 00:56:50 +0200 |
parents | 97dcd6906e6f |
children | a87443d4aec0 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Jun 08 09:31:01 2022 +0200 +++ b/mercurial/dirstate.py Sat Jun 11 00:56:50 2022 +0200 @@ -27,7 +27,6 @@ policy, pycompat, scmutil, - sparse, util, ) @@ -113,6 +112,7 @@ self._opener = opener self._validate = validate self._root = root + # Either build a sparse-matcher or None if sparse is disabled self._sparsematchfn = sparsematchfn # ntpath.join(root, '') of Python 2.7.9 does not add sep if root is # UNC path pointing to root share (issue4557) @@ -184,7 +184,11 @@ The working directory may not include every file from a manifest. The matcher obtained by this property will match a path if it is to be included in the working directory. + + When sparse if disabled, return None. """ + if self._sparsematchfn is None: + return None # TODO there is potential to cache this property. For now, the matcher # is resolved on every access. (But the called function does use a # cache to keep the lookup fast.) @@ -1259,7 +1263,7 @@ use_rust = False elif subrepos: use_rust = False - elif sparse.enabled: + elif self._sparsematchfn is not None: use_rust = False elif not isinstance(match, allowed_matchers): # Some matchers have yet to be implemented