~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Dirty merge of the mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
import bzrlib
34
34
from bzrlib.errors import (BzrError,
35
 
                           BzrBadParameter,
 
35
                           BzrBadParameterNotUnicode,
36
36
                           NoSuchFile,
37
37
                           PathNotChild,
38
38
                           )
336
336
        tofile.write(b)
337
337
 
338
338
 
 
339
def file_iterator(input_file, readsize=32768):
 
340
    while True:
 
341
        b = input_file.read(readsize)
 
342
        if len(b) == 0:
 
343
            break
 
344
        yield b
 
345
 
 
346
 
339
347
def sha_file(f):
340
348
    if hasattr(f, 'tell'):
341
349
        assert f.tell() == 0
595
603
    try:
596
604
        return unicode_or_utf8_string.decode('utf8')
597
605
    except UnicodeDecodeError:
598
 
        raise BzrBadParameter(unicode_or_utf8_string)
 
606
        raise BzrBadParameterNotUnicode(unicode_or_utf8_string)
599
607
 
600
608
 
601
609
def terminal_width():