~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2005-11-20 17:30:01 UTC
  • mto: (1185.50.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1518.
  • Revision ID: john@arbash-meinel.com-20051120173001-f073d581983ee3ba
Changed pumpfile to work on blocks, rather than reading the entire file at once.

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
 
241
241
def pumpfile(fromfile, tofile):
242
242
    """Copy contents of one file to another."""
243
 
    tofile.write(fromfile.read())
 
243
    BUFSIZE = 32768
 
244
    while True:
 
245
        b = fromfile.read(BUFSIZE)
 
246
        if not b:
 
247
            break
 
248
        tofile.write(BUFSIZE)
244
249
 
245
250
 
246
251
def sha_file(f):