equal
deleted
inserted
replaced
332 """ |
332 """ |
333 m = copy.copy(match) |
333 m = copy.copy(match) |
334 m.bad = badfn |
334 m.bad = badfn |
335 return m |
335 return m |
336 |
336 |
337 class narrowmatcher(match): |
337 class subdirmatcher(match): |
338 """Adapt a matcher to work on a subdirectory only. |
338 """Adapt a matcher to work on a subdirectory only. |
339 |
339 |
340 The paths are remapped to remove/insert the path as needed: |
340 The paths are remapped to remove/insert the path as needed: |
341 |
341 |
342 >>> m1 = match('root', '', ['a.txt', 'sub/b.txt']) |
342 >>> m1 = match('root', '', ['a.txt', 'sub/b.txt']) |
343 >>> m2 = narrowmatcher('sub', m1) |
343 >>> m2 = subdirmatcher('sub', m1) |
344 >>> bool(m2('a.txt')) |
344 >>> bool(m2('a.txt')) |
345 False |
345 False |
346 >>> bool(m2('b.txt')) |
346 >>> bool(m2('b.txt')) |
347 True |
347 True |
348 >>> bool(m2.matchfn('a.txt')) |
348 >>> bool(m2.matchfn('a.txt')) |