/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/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-25 02:03:41 UTC
  • mfrom: (4187.3.6 remote-pack-hack)
  • Revision ID: pqm@pqm.ubuntu.com-20090325020341-dmq0yek061gtungf
(andrew) Buffer writes when pushing to a pack repository on a
        pre-1.12 smart server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3750
3750
    def _locked_insert_stream(self, stream, src_format):
3751
3751
        to_serializer = self.target_repo._format._serializer
3752
3752
        src_serializer = src_format._serializer
 
3753
        if to_serializer == src_serializer:
 
3754
            # If serializers match and the target is a pack repository, set the
 
3755
            # write cache size on the new pack.  This avoids poor performance
 
3756
            # on transports where append is unbuffered (such as
 
3757
            # RemoteTransport).  This is safe to do because nothing should read
 
3758
            # back from the target repository while a stream with matching
 
3759
            # serialization is being inserted.
 
3760
            # The exception is that a delta record from the source that should
 
3761
            # be a fulltext may need to be expanded by the target (see
 
3762
            # test_fetch_revisions_with_deltas_into_pack); but we take care to
 
3763
            # explicitly flush any buffered writes first in that rare case.
 
3764
            try:
 
3765
                new_pack = self.target_repo._pack_collection._new_pack
 
3766
            except AttributeError:
 
3767
                # Not a pack repository
 
3768
                pass
 
3769
            else:
 
3770
                new_pack.set_write_cache_size(1024*1024)
3753
3771
        for substream_type, substream in stream:
3754
3772
            if substream_type == 'texts':
3755
3773
                self.target_repo.texts.insert_record_stream(substream)