Show More
@@ -181,11 +181,11 b' def match(root, cwd, patterns=None, incl' | |||
|
181 | 181 | |
|
182 | 182 | 1. Calling the matcher with a file name returns True if any pattern |
|
183 | 183 | matches that file name: |
|
184 |
>>> |
|
|
184 | >>> m('a') | |
|
185 | 185 | True |
|
186 |
>>> |
|
|
186 | >>> m('main.c') | |
|
187 | 187 | True |
|
188 |
>>> |
|
|
188 | >>> m('test.py') | |
|
189 | 189 | False |
|
190 | 190 | |
|
191 | 191 | 2. Using the exact() method only returns True if the file name matches one |
@@ -490,17 +490,17 b' class patternmatcher(basematcher):' | |||
|
490 | 490 | ... ('glob', '*.h', ''), |
|
491 | 491 | ... ] |
|
492 | 492 | >>> m = patternmatcher('foo', kindpats) |
|
493 |
>>> |
|
|
493 | >>> m('main.c') # matches re:.*\.c$ | |
|
494 | 494 | True |
|
495 |
>>> |
|
|
495 | >>> m('b.txt') | |
|
496 | 496 | False |
|
497 |
>>> |
|
|
497 | >>> m('foo/a') # matches path:foo/a | |
|
498 | 498 | True |
|
499 |
>>> |
|
|
499 | >>> m('a') # does not match path:b, since 'root' is 'foo' | |
|
500 | 500 | False |
|
501 |
>>> |
|
|
501 | >>> m('b') # matches relpath:b, since 'root' is 'foo' | |
|
502 | 502 | True |
|
503 |
>>> |
|
|
503 | >>> m('lib.h') # matches glob:*.h | |
|
504 | 504 | True |
|
505 | 505 | |
|
506 | 506 | >>> m.files() |
@@ -871,13 +871,13 b' class subdirmatcher(basematcher):' | |||
|
871 | 871 | >>> from . import pycompat |
|
872 | 872 | >>> m1 = match(b'root', b'', [b'a.txt', b'sub/b.txt']) |
|
873 | 873 | >>> m2 = subdirmatcher(b'sub', m1) |
|
874 |
>>> |
|
|
874 | >>> m2(b'a.txt') | |
|
875 | 875 | False |
|
876 |
>>> |
|
|
876 | >>> m2(b'b.txt') | |
|
877 | 877 | True |
|
878 |
>>> |
|
|
878 | >>> m2.matchfn(b'a.txt') | |
|
879 | 879 | False |
|
880 |
>>> |
|
|
880 | >>> m2.matchfn(b'b.txt') | |
|
881 | 881 | True |
|
882 | 882 | >>> m2.files() |
|
883 | 883 | ['b.txt'] |
@@ -950,11 +950,11 b' class prefixdirmatcher(basematcher):' | |||
|
950 | 950 | |
|
951 | 951 | >>> m1 = match(util.localpath(b'root/d/e'), b'f', [b'../a.txt', b'b.txt']) |
|
952 | 952 | >>> m2 = prefixdirmatcher(b'd/e', m1) |
|
953 |
>>> |
|
|
953 | >>> m2(b'a.txt') | |
|
954 | 954 | False |
|
955 |
>>> |
|
|
955 | >>> m2(b'd/e/a.txt') | |
|
956 | 956 | True |
|
957 |
>>> |
|
|
957 | >>> m2(b'd/e/b.txt') | |
|
958 | 958 | False |
|
959 | 959 | >>> m2.files() |
|
960 | 960 | ['d/e/a.txt', 'd/e/f/b.txt'] |
@@ -1287,7 +1287,8 b' def _buildregexmatch(kindpats, globsuffi' | |||
|
1287 | 1287 | groupsize += piecesize + 1 |
|
1288 | 1288 | |
|
1289 | 1289 | if startidx == 0: |
|
1290 |
|
|
|
1290 | matcher = _rematcher(fullregexp) | |
|
1291 | func = lambda s: matcher(s) is not None | |
|
1291 | 1292 | else: |
|
1292 | 1293 | group = regexps[startidx:] |
|
1293 | 1294 | allgroups.append(_joinregexes(group)) |
General Comments 0
You need to be logged in to leave comments.
Login now