~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/globbing.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-10 17:16:19 UTC
  • mfrom: (4884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4889.
  • Revision ID: john@arbash-meinel.com-20091210171619-ehdcxjbl8afhq9g1
Bring in bzr.dev 4884

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