~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ignores.py

  • Committer: Jason Spashett
  • Date: 2009-10-06 19:50:18 UTC
  • mto: (5121.1.1 183504-ignores)
  • mto: This revision was merged to the branch mainline in revision 5122.
  • Revision ID: jason@spashett.com-20091006195018-lkv9jdw4v76q5qnn
ReverseĀ mergeĀ 4670..4668

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    config,
25
25
    globbing,
26
26
    )
27
 
from trace import warning
28
27
 
29
28
# This was the full ignore list for bzr 0.8
30
29
# please keep these sorted (in C locale order) to aid merging
104
103
def parse_ignore_file(f):
105
104
    """Read in all of the lines in the file and turn it into an ignore list"""
106
105
    ignored = set()
107
 
    line_number = 0 # Line counting to report character decode errors
108
 
    for line in f.read().split('\n'):
109
 
        line_number +=1
110
 
        # Decode the line here, and catch any decoding errors
111
 
        try:
112
 
            line = line.decode('utf8').rstrip('\r\n')
113
 
            if not line or line.startswith('#'):
114
 
                continue
115
 
            ignored.add(globbing.normalize_pattern(line))
116
 
        except UnicodeDecodeError:
117
 
            warning('.bzrignore: On Line %d, malformed utf8 character. Ignoring line.'
118
 
                  % (line_number))
 
106
    for line in f.read().decode('utf8').split('\n'):
 
107
        line = line.rstrip('\r\n')
 
108
        if not line or line.startswith('#'):
 
109
            continue
 
110
        ignored.add(globbing.normalize_pattern(line))
119
111
    return ignored
120
112
 
121
113