Show More
@@ -1427,6 +1427,18 b' class workingctx(committablectx):' | |||
|
1427 | 1427 | finally: |
|
1428 | 1428 | wlock.release() |
|
1429 | 1429 | |
|
1430 | def match(self, pats=[], include=None, exclude=None, default='glob'): | |
|
1431 | r = self._repo | |
|
1432 | ||
|
1433 | # Only a case insensitive filesystem needs magic to translate user input | |
|
1434 | # to actual case in the filesystem. | |
|
1435 | if not util.checkcase(r.root): | |
|
1436 | return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, | |
|
1437 | exclude, default, r.auditor, self) | |
|
1438 | return matchmod.match(r.root, r.getcwd(), pats, | |
|
1439 | include, exclude, default, | |
|
1440 | auditor=r.auditor, ctx=self) | |
|
1441 | ||
|
1430 | 1442 | def _filtersuspectsymlink(self, files): |
|
1431 | 1443 | if not files or self._repo.dirstate._checklink: |
|
1432 | 1444 | return files |
@@ -273,6 +273,34 b' class narrowmatcher(match):' | |||
|
273 | 273 | def rel(self, f): |
|
274 | 274 | return self._matcher.rel(self._path + "/" + f) |
|
275 | 275 | |
|
276 | class icasefsmatcher(match): | |
|
277 | """A matcher for wdir on case insensitive filesystems, which normalizes the | |
|
278 | given patterns to the case in the filesystem. | |
|
279 | """ | |
|
280 | ||
|
281 | def __init__(self, root, cwd, patterns, include, exclude, default, auditor, | |
|
282 | ctx): | |
|
283 | init = super(icasefsmatcher, self).__init__ | |
|
284 | self._dsnormalize = ctx.repo().dirstate.normalize | |
|
285 | ||
|
286 | init(root, cwd, patterns, include, exclude, default, auditor=auditor, | |
|
287 | ctx=ctx) | |
|
288 | ||
|
289 | # m.exact(file) must be based off of the actual user input, otherwise | |
|
290 | # inexact case matches are treated as exact, and not noted without -v. | |
|
291 | if self._files: | |
|
292 | self._fmap = set(_roots(self._kp)) | |
|
293 | ||
|
294 | def _normalize(self, patterns, default, root, cwd, auditor): | |
|
295 | self._kp = super(icasefsmatcher, self)._normalize(patterns, default, | |
|
296 | root, cwd, auditor) | |
|
297 | kindpats = [] | |
|
298 | for kind, pats in self._kp: | |
|
299 | if kind not in ('re', 'relre'): # regex can't be normalized | |
|
300 | pats = self._dsnormalize(pats) | |
|
301 | kindpats.append((kind, pats)) | |
|
302 | return kindpats | |
|
303 | ||
|
276 | 304 | def patkind(pattern, default=None): |
|
277 | 305 | '''If pattern is 'kind:pat' with a known kind, return kind.''' |
|
278 | 306 | return _patsplit(pattern, default)[0] |
@@ -176,12 +176,48 b" Test that adding a directory doesn't req" | |||
|
176 | 176 | $ mkdir CapsDir1/CapsDir/SubDir |
|
177 | 177 | $ echo def > CapsDir1/CapsDir/SubDir/Def.txt |
|
178 | 178 | |
|
179 |
$ hg add |
|
|
179 | $ hg add capsdir1/capsdir | |
|
180 | 180 | adding CapsDir1/CapsDir/AbC.txt (glob) |
|
181 | 181 | adding CapsDir1/CapsDir/SubDir/Def.txt (glob) |
|
182 | 182 | |
|
183 | 183 | $ hg forget capsdir1/capsdir/abc.txt |
|
184 | 184 | removing CapsDir1/CapsDir/AbC.txt (glob) |
|
185 | ||
|
186 | $ hg forget capsdir1/capsdir | |
|
187 | removing CapsDir1/CapsDir/SubDir/Def.txt (glob) | |
|
188 | ||
|
189 | $ hg add capsdir1 | |
|
190 | adding CapsDir1/CapsDir/AbC.txt (glob) | |
|
191 | adding CapsDir1/CapsDir/SubDir/Def.txt (glob) | |
|
192 | ||
|
193 | $ hg ci -m "AbCDef" capsdir1/capsdir | |
|
194 | ||
|
195 | $ hg status -A capsdir1/capsdir | |
|
196 | C CapsDir1/CapsDir/AbC.txt | |
|
197 | C CapsDir1/CapsDir/SubDir/Def.txt | |
|
198 | ||
|
199 | $ hg files capsdir1/capsdir | |
|
200 | CapsDir1/CapsDir/AbC.txt (glob) | |
|
201 | CapsDir1/CapsDir/SubDir/Def.txt (glob) | |
|
202 | ||
|
203 | $ echo xyz > CapsDir1/CapsDir/SubDir/Def.txt | |
|
204 | $ hg ci -m xyz capsdir1/capsdir/subdir/def.txt | |
|
205 | ||
|
206 | $ hg revert -r '.^' capsdir1/capsdir | |
|
207 | reverting CapsDir1/CapsDir/SubDir/Def.txt (glob) | |
|
208 | ||
|
209 | $ hg diff capsdir1/capsdir | |
|
210 | diff -r 5112e00e781d CapsDir1/CapsDir/SubDir/Def.txt | |
|
211 | --- a/CapsDir1/CapsDir/SubDir/Def.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
212 | +++ b/CapsDir1/CapsDir/SubDir/Def.txt * +0000 (glob) | |
|
213 | @@ -1,1 +1,1 @@ | |
|
214 | -xyz | |
|
215 | +def | |
|
216 | ||
|
217 | $ hg remove -f 'glob:**.txt' -X capsdir1/capsdir | |
|
218 | $ hg remove -f 'glob:**.txt' -I capsdir1/capsdir | |
|
219 | removing CapsDir1/CapsDir/AbC.txt (glob) | |
|
220 | removing CapsDir1/CapsDir/SubDir/Def.txt (glob) | |
|
185 | 221 | #endif |
|
186 | 222 | |
|
187 | 223 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now