equal
deleted
inserted
replaced
552 return b'' |
552 return b'' |
553 return dir |
553 return dir |
554 |
554 |
555 |
555 |
556 class patternmatcher(basematcher): |
556 class patternmatcher(basematcher): |
557 """Matches a set of (kind, pat, source) against a 'root' directory. |
557 r"""Matches a set of (kind, pat, source) against a 'root' directory. |
558 |
558 |
559 >>> kindpats = [ |
559 >>> kindpats = [ |
560 ... (b're', br'.*\.c$', b''), |
560 ... (b're', br'.*\.c$', b''), |
561 ... (b'path', b'foo/a', b''), |
561 ... (b'path', b'foo/a', b''), |
562 ... (b'relpath', b'b', b''), |
562 ... (b'relpath', b'b', b''), |
1170 def __repr__(self): |
1170 def __repr__(self): |
1171 return b'<unionmatcher matchers=%r>' % self._matchers |
1171 return b'<unionmatcher matchers=%r>' % self._matchers |
1172 |
1172 |
1173 |
1173 |
1174 def patkind(pattern, default=None): |
1174 def patkind(pattern, default=None): |
1175 '''If pattern is 'kind:pat' with a known kind, return kind. |
1175 r'''If pattern is 'kind:pat' with a known kind, return kind. |
1176 |
1176 |
1177 >>> patkind(br're:.*\.c$') |
1177 >>> patkind(br're:.*\.c$') |
1178 're' |
1178 're' |
1179 >>> patkind(b'glob:*.c') |
1179 >>> patkind(b'glob:*.c') |
1180 'glob' |
1180 'glob' |