##// END OF EJS Templates
sparse: use None as the sparse matcher value when disabled...
marmoute -
r50250:0540c162 default
parent child Browse files
Show More
@@ -216,6 +216,8 b' def _setupdirstate(ui):'
216 216 def walk(orig, self, match, subrepos, unknown, ignored, full=True):
217 217 # hack to not exclude explicitly-specified paths so that they can
218 218 # be warned later on e.g. dirstate.add()
219 sparse_matcher = self._sparsematcher
220 if sparse_matcher is not None:
219 221 em = matchmod.exact(match.files())
220 222 sm = matchmod.unionmatcher([self._sparsematcher, em])
221 223 match = matchmod.intersectmatchers(match, sm)
@@ -226,7 +228,7 b' def _setupdirstate(ui):'
226 228 # dirstate.rebuild should not add non-matching files
227 229 def _rebuild(orig, self, parent, allfiles, changedfiles=None):
228 230 matcher = self._sparsematcher
229 if not matcher.always():
231 if matcher is not None and not matcher.always():
230 232 allfiles = [f for f in allfiles if matcher(f)]
231 233 if changedfiles:
232 234 changedfiles = [f for f in changedfiles if matcher(f)]
@@ -255,7 +257,7 b' def _setupdirstate(ui):'
255 257
256 258 def _wrapper(orig, self, *args, **kwargs):
257 259 sparsematch = self._sparsematcher
258 if not sparsematch.always():
260 if sparsematch is not None and not sparsematch.always():
259 261 for f in args:
260 262 if f is not None and not sparsematch(f) and f not in self:
261 263 raise error.Abort(
@@ -27,7 +27,6 b' from . import ('
27 27 policy,
28 28 pycompat,
29 29 scmutil,
30 sparse,
31 30 util,
32 31 )
33 32
@@ -113,6 +112,7 b' class dirstate:'
113 112 self._opener = opener
114 113 self._validate = validate
115 114 self._root = root
115 # Either build a sparse-matcher or None if sparse is disabled
116 116 self._sparsematchfn = sparsematchfn
117 117 # ntpath.join(root, '') of Python 2.7.9 does not add sep if root is
118 118 # UNC path pointing to root share (issue4557)
@@ -184,7 +184,11 b' class dirstate:'
184 184 The working directory may not include every file from a manifest. The
185 185 matcher obtained by this property will match a path if it is to be
186 186 included in the working directory.
187
188 When sparse if disabled, return None.
187 189 """
190 if self._sparsematchfn is None:
191 return None
188 192 # TODO there is potential to cache this property. For now, the matcher
189 193 # is resolved on every access. (But the called function does use a
190 194 # cache to keep the lookup fast.)
@@ -1259,7 +1263,7 b' class dirstate:'
1259 1263 use_rust = False
1260 1264 elif subrepos:
1261 1265 use_rust = False
1262 elif sparse.enabled:
1266 elif self._sparsematchfn is not None:
1263 1267 use_rust = False
1264 1268 elif not isinstance(match, allowed_matchers):
1265 1269 # Some matchers have yet to be implemented
@@ -1747,6 +1747,8 b' class localrepository:'
1747 1747
1748 1748 def _makedirstate(self):
1749 1749 """Extension point for wrapping the dirstate per-repo."""
1750 sparsematchfn = None
1751 if sparse.use_sparse(self):
1750 1752 sparsematchfn = lambda: sparse.matcher(self)
1751 1753 v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT
1752 1754 th = requirementsmod.DIRSTATE_TRACKED_HINT_V1
General Comments 0
You need to be logged in to leave comments. Login now