~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/globbing.py

  • Committer: Gordon Tyler
  • Date: 2010-01-14 15:24:04 UTC
  • mto: (5037.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5046.
  • Revision ID: gordon@doxxx.net-20100114152404-d64ik2afl96lcml0
Reverted changes to test_rules since the original should work now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
                    prefix=r'(?:.*/)?(?!.*/)')
239
239
 
240
240
 
 
241
_slashes = re.compile(r'[\\/]+')
241
242
def normalize_pattern(pattern):
242
243
    """Converts backslashes in path patterns to forward slashes.
243
244
 
244
245
    Doesn't normalize regular expressions - they may contain escapes.
245
246
    """
 
247
 
246
248
    if not pattern.startswith('RE:'):
247
 
        pattern = pattern.replace('\\','/')
248
 
    return pattern.rstrip('/')
 
249
        pattern = _slashes.sub('/', pattern)
 
250
    if len(pattern) > 1:
 
251
        pattern = pattern.rstrip('/')
 
252
    return pattern