Show More
@@ -469,22 +469,20 def _matcher(canonroot, cwd, names, inc, | |||||
469 | """build a matching function from a set of patterns""" |
|
469 | """build a matching function from a set of patterns""" | |
470 | if not pats: |
|
470 | if not pats: | |
471 | return |
|
471 | return | |
472 | matches = [] |
|
472 | try: | |
|
473 | pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats]) | |||
|
474 | return re.compile(pat).match | |||
|
475 | except re.error: | |||
473 | for k, p in pats: |
|
476 | for k, p in pats: | |
474 | try: |
|
477 | try: | |
475 |
|
|
478 | re.compile('(?:%s)' % regex(k, p, tail)) | |
476 | matches.append(re.compile(pat).match) |
|
|||
477 | except re.error: |
|
479 | except re.error: | |
478 | if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p)) |
|
480 | if src: | |
479 |
|
|
481 | raise Abort("%s: invalid pattern (%s): %s" % | |
480 |
|
482 | (src, k, p)) | ||
481 | def buildfn(text): |
|
483 | else: | |
482 | for m in matches: |
|
484 | raise Abort("invalid pattern (%s): %s" % (k, p)) | |
483 | r = m(text) |
|
485 | raise Abort("invalid pattern") | |
484 | if r: |
|
|||
485 | return r |
|
|||
486 |
|
||||
487 | return buildfn |
|
|||
488 |
|
486 | |||
489 | def globprefix(pat): |
|
487 | def globprefix(pat): | |
490 | '''return the non-glob prefix of a path, e.g. foo/* -> foo''' |
|
488 | '''return the non-glob prefix of a path, e.g. foo/* -> foo''' |
General Comments 0
You need to be logged in to leave comments.
Login now