--- a/mercurial/dirstate.py Sat Jul 08 15:42:11 2017 -0700
+++ b/mercurial/dirstate.py Sat Jul 08 16:18:04 2017 -0700
@@ -70,7 +70,7 @@
class dirstate(object):
- def __init__(self, opener, ui, root, validate):
+ def __init__(self, opener, ui, root, validate, sparsematchfn):
'''Create a new dirstate object.
opener is an open()-like callable that can be used to open the
@@ -80,6 +80,7 @@
self._opener = opener
self._validate = validate
self._root = root
+ 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)
self._rootdir = pathutil.normasprefix(root)
@@ -197,6 +198,19 @@
f[normcase(name)] = name
return f
+ @property
+ def _sparsematcher(self):
+ """The matcher for the sparse checkout.
+
+ 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.
+ """
+ # 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.)
+ return self._sparsematchfn()
+
@repocache('branch')
def _branch(self):
try: