##// END OF EJS Templates
sparse: override dirstate.walk() instead of dirstate._ignore...
Martin von Zweigbergk -
r33496:258298f4 default
parent child Browse files
Show More
@@ -192,36 +192,11 b' def _setupdirstate(ui):'
192 and to prevent modifications to files outside the checkout.
192 and to prevent modifications to files outside the checkout.
193 """
193 """
194
194
195 # The atrocity below is needed to wrap dirstate._ignore. It is a cached
195 def walk(orig, self, match, subrepos, unknown, ignored, full=True):
196 # property, which means normal function wrapping doesn't work.
196 match = matchmod.intersectmatchers(match, self._sparsematcher)
197 class ignorewrapper(object):
197 return orig(self, match, subrepos, unknown, ignored, full)
198 def __init__(self, orig):
199 self.orig = orig
200 self.origignore = None
201 self.func = None
202 self.sparsematch = None
203
204 def __get__(self, obj, type=None):
205 origignore = self.orig.__get__(obj)
206
198
207 sparsematch = obj._sparsematcher
199 extensions.wrapfunction(dirstate.dirstate, 'walk', walk)
208 if sparsematch.always():
209 return origignore
210
211 if self.sparsematch != sparsematch or self.origignore != origignore:
212 self.func = matchmod.unionmatcher([
213 origignore, matchmod.negatematcher(sparsematch)])
214 self.sparsematch = sparsematch
215 self.origignore = origignore
216 return self.func
217
218 def __set__(self, obj, value):
219 return self.orig.__set__(obj, value)
220
221 def __delete__(self, obj):
222 return self.orig.__delete__(obj)
223
224 replacefilecache(dirstate.dirstate, '_ignore', ignorewrapper)
225
200
226 # dirstate.rebuild should not add non-matching files
201 # dirstate.rebuild should not add non-matching files
227 def _rebuild(orig, self, parent, allfiles, changedfiles=None):
202 def _rebuild(orig, self, parent, allfiles, changedfiles=None):
@@ -144,10 +144,15 b' Verify adding sparseness hides files'
144 M show
144 M show
145
145
146 $ hg up -qC .
146 $ hg up -qC .
147 TODO: add an option to purge to also purge files outside the sparse config?
147 $ hg purge --all --config extensions.purge=
148 $ hg purge --all --config extensions.purge=
148 $ ls
149 $ ls
150 hide
151 hide3
149 show
152 show
150 show2
153 show2
154 For now, manually remove the files
155 $ rm hide hide3
151
156
152 Verify rebase temporarily includes excluded files
157 Verify rebase temporarily includes excluded files
153
158
General Comments 0
You need to be logged in to leave comments. Login now