~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/textfile.py

  • Committer: Aaron Bentley
  • Date: 2006-04-16 15:52:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1673.
  • Revision ID: aaron.bentley@utoronto.ca-20060416155229-dd8b35cdc5d134ce
Implemented binary file handling for diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    if '\x00' in first_chunk:
12
12
        raise BinaryFile()
13
13
    return IterableFile(chain((first_chunk,), file_iterator(input)))
 
14
 
 
15
 
 
16
def check_text_lines(lines):
 
17
    """Raise BinaryFile if the supplied lines contain NULs.
 
18
    Only the first 1024 characters are checked.
 
19
    """
 
20
    f = IterableFile(lines)
 
21
    if '\x00' in f.read(1024):
 
22
        raise BinaryFile()