##// END OF EJS Templates
match: add optional warn argument...
Durham Goode -
r25214:08703b10 default
parent child Browse files
Show More
@@ -54,7 +54,7 b' def _kindpatsalwaysmatch(kindpats):'
54 class match(object):
54 class match(object):
55 def __init__(self, root, cwd, patterns, include=[], exclude=[],
55 def __init__(self, root, cwd, patterns, include=[], exclude=[],
56 default='glob', exact=False, auditor=None, ctx=None,
56 default='glob', exact=False, auditor=None, ctx=None,
57 listsubrepos=False):
57 listsubrepos=False, warn=None):
58 """build an object to match a set of file patterns
58 """build an object to match a set of file patterns
59
59
60 arguments:
60 arguments:
@@ -65,6 +65,7 b' class match(object):'
65 exclude - patterns to exclude (even if they are included)
65 exclude - patterns to exclude (even if they are included)
66 default - if a pattern in patterns has no explicit type, assume this one
66 default - if a pattern in patterns has no explicit type, assume this one
67 exact - patterns are actually filenames (include/exclude still apply)
67 exact - patterns are actually filenames (include/exclude still apply)
68 warn - optional function used for printing warnings
68
69
69 a pattern is one of:
70 a pattern is one of:
70 'glob:<glob>' - a glob relative to cwd
71 'glob:<glob>' - a glob relative to cwd
@@ -83,6 +84,7 b' class match(object):'
83 self._anypats = bool(include or exclude)
84 self._anypats = bool(include or exclude)
84 self._always = False
85 self._always = False
85 self._pathrestricted = bool(include or exclude or patterns)
86 self._pathrestricted = bool(include or exclude or patterns)
87 self._warn = warn
86
88
87 matchfns = []
89 matchfns = []
88 if include:
90 if include:
@@ -536,7 +538,9 b' def readpatternfile(filepath, warn):'
536 try:
538 try:
537 syntax = syntaxes[s]
539 syntax = syntaxes[s]
538 except KeyError:
540 except KeyError:
539 warn(_("%s: ignoring invalid syntax '%s'\n") % (filepath, s))
541 if warn:
542 warn(_("%s: ignoring invalid syntax '%s'\n") %
543 (filepath, s))
540 continue
544 continue
541
545
542 linesyntax = syntax
546 linesyntax = syntax
General Comments 0
You need to be logged in to leave comments. Login now