/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Merge bzr.dev 4187, and revert the change to fix refcycle issues.

I apparently didn't run the smart fetch tests. Which show that we access inv+chk pages
as a fulltext, and then insert the stream, which expects to get the block as a compressed
block. :(.
Need to rethink how to do it, possibly with weakrefs.


This also brings in CommitBuilder.record_iter_changes() and the updates to btree_index
and backing indices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
597
597
    return s.hexdigest()
598
598
 
599
599
 
 
600
def size_sha_file(f):
 
601
    """Calculate the size and hexdigest of an open file.
 
602
 
 
603
    The file cursor should be already at the start and
 
604
    the caller is responsible for closing the file afterwards.
 
605
    """
 
606
    size = 0
 
607
    s = sha()
 
608
    BUFSIZE = 128<<10
 
609
    while True:
 
610
        b = f.read(BUFSIZE)
 
611
        if not b:
 
612
            break
 
613
        size += len(b)
 
614
        s.update(b)
 
615
    return size, s.hexdigest()
 
616
 
 
617
 
600
618
def sha_file_by_name(fname):
601
619
    """Calculate the SHA1 of a file by reading the full text"""
602
620
    s = sha()