~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/globbing.py

  • Committer: Martin Pool
  • Date: 2011-06-13 22:39:49 UTC
  • mto: This revision was merged to the branch mainline in revision 6004.
  • Revision ID: mbp@canonical.com-20110613223949-bxs9qknusts7llkp
Explicitly use lazy_regexp where we count on its error reporting behaviour

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
 
23
23
import re
24
24
 
25
 
from bzrlib import errors
 
25
from bzrlib import (
 
26
    errors,
 
27
    lazy_regex,
 
28
    )
26
29
from bzrlib.trace import (
27
30
    mutter,
28
31
    warning,
217
220
 
218
221
    def _add_patterns(self, patterns, translator, prefix=''):
219
222
        while patterns:
220
 
            grouped_rules = ['(%s)' % translator(pat) for pat in patterns[:99]]
 
223
            grouped_rules = [
 
224
                '(%s)' % translator(pat) for pat in patterns[:99]]
221
225
            joined_rule = '%s(?:%s)$' % (prefix, '|'.join(grouped_rules))
222
 
            self._regex_patterns.append((re.compile(joined_rule, re.UNICODE),
 
226
            # Explicitly use lazy_compile here, because we count on its
 
227
            # nicer error reporting.
 
228
            self._regex_patterns.append((
 
229
                lazy_regex.lazy_compile(joined_rule, re.UNICODE),
223
230
                patterns[:99]))
224
231
            patterns = patterns[99:]
225
232