##// END OF EJS Templates
match: add an optional constructor parameter for a bad() override...
Matt Harbison -
r25464:504a1f29 default
parent child Browse files
Show More
@@ -78,7 +78,7 b' def _kindpatsalwaysmatch(kindpats):'
78 78 class match(object):
79 79 def __init__(self, root, cwd, patterns, include=[], exclude=[],
80 80 default='glob', exact=False, auditor=None, ctx=None,
81 listsubrepos=False, warn=None):
81 listsubrepos=False, warn=None, badfn=None):
82 82 """build an object to match a set of file patterns
83 83
84 84 arguments:
@@ -90,6 +90,7 b' class match(object):'
90 90 default - if a pattern in patterns has no explicit type, assume this one
91 91 exact - patterns are actually filenames (include/exclude still apply)
92 92 warn - optional function used for printing warnings
93 badfn - optional bad() callback for this matcher instead of the default
93 94
94 95 a pattern is one of:
95 96 'glob:<glob>' - a glob relative to cwd
@@ -116,6 +117,9 b' class match(object):'
116 117 self._includedirs = set(['.'])
117 118 self._excluderoots = set()
118 119
120 if badfn is not None:
121 self.bad = badfn
122
119 123 matchfns = []
120 124 if include:
121 125 kindpats = self._normalize(include, 'glob', root, cwd, auditor)
@@ -299,8 +303,8 b' class match(object):'
299 303 kindpats.append((kind, pat, ''))
300 304 return kindpats
301 305
302 def exact(root, cwd, files):
303 return match(root, cwd, files, exact=True)
306 def exact(root, cwd, files, badfn=None):
307 return match(root, cwd, files, exact=True, badfn=badfn)
304 308
305 309 def always(root, cwd):
306 310 return match(root, cwd, [])
@@ -378,12 +382,12 b' class icasefsmatcher(match):'
378 382 """
379 383
380 384 def __init__(self, root, cwd, patterns, include, exclude, default, auditor,
381 ctx, listsubrepos=False):
385 ctx, listsubrepos=False, badfn=None):
382 386 init = super(icasefsmatcher, self).__init__
383 387 self._dsnormalize = ctx.repo().dirstate.normalize
384 388
385 389 init(root, cwd, patterns, include, exclude, default, auditor=auditor,
386 ctx=ctx, listsubrepos=listsubrepos)
390 ctx=ctx, listsubrepos=listsubrepos, badfn=badfn)
387 391
388 392 # m.exact(file) must be based off of the actual user input, otherwise
389 393 # inexact case matches are treated as exact, and not noted without -v.
General Comments 0
You need to be logged in to leave comments. Login now