/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/repofmt/groupcompress_repo.py

  • Committer: mbp at sourcefrog
  • Date: 2011-04-11 01:23:58 UTC
  • mfrom: (5777 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5802.
  • Revision ID: mbp@sourcefrog.net-20110411012358-gl07rdtxydlq7fh1
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    GroupCompressVersionedFiles,
45
45
    )
46
46
from bzrlib.repofmt.pack_repo import (
 
47
    _DirectPackAccess,
47
48
    Pack,
48
49
    NewPack,
49
 
    KnitPackRepository,
50
 
    KnitPackStreamSource,
 
50
    PackRepository,
51
51
    PackRootCommitBuilder,
52
52
    RepositoryPackCollection,
53
53
    RepositoryFormatPack,
54
54
    ResumedPack,
55
55
    Packer,
56
56
    )
 
57
from bzrlib.repository import (
 
58
    StreamSource,
 
59
    )
57
60
from bzrlib.static_tuple import StaticTuple
58
61
 
59
62
 
352
355
        """Build a VersionedFiles instance on top of this group of packs."""
353
356
        index_name = index_name + '_index'
354
357
        index_to_pack = {}
355
 
        access = knit._DirectPackAccess(index_to_pack,
356
 
                                        reload_func=self._reload_func)
 
358
        access = _DirectPackAccess(index_to_pack,
 
359
                                   reload_func=self._reload_func)
357
360
        if for_write:
358
361
            # Use new_pack
359
362
            if self.new_pack is None:
829
832
        return result
830
833
 
831
834
 
832
 
class CHKInventoryRepository(KnitPackRepository):
833
 
    """subclass of KnitPackRepository that uses CHK based inventories."""
 
835
class CHKInventoryRepository(PackRepository):
 
836
    """subclass of PackRepository that uses CHK based inventories."""
834
837
 
835
838
    def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
836
839
        _serializer):
837
840
        """Overridden to change pack collection class."""
838
 
        KnitPackRepository.__init__(self, _format, a_bzrdir, control_files,
 
841
        super(CHKInventoryRepository, self).__init__(_format, a_bzrdir, control_files,
839
842
            _commit_builder_class, _serializer)
840
 
        # and now replace everything it did :)
841
843
        index_transport = self._transport.clone('indices')
842
844
        self._pack_collection = GCRepositoryPackCollection(self,
843
845
            self._transport, index_transport,
1147
1149
        return super(CHKInventoryRepository, self)._get_source(to_format)
1148
1150
 
1149
1151
 
1150
 
class GroupCHKStreamSource(KnitPackStreamSource):
 
1152
class GroupCHKStreamSource(StreamSource):
1151
1153
    """Used when both the source and target repo are GroupCHK repos."""
1152
1154
 
1153
1155
    def __init__(self, from_repository, to_format):
1240
1242
            self._chk_p_id_roots = None
1241
1243
        yield 'chk_bytes', _get_parent_id_basename_to_file_id_pages()
1242
1244
 
 
1245
    def _get_text_stream(self):
 
1246
        # Note: We know we don't have to handle adding root keys, because both
 
1247
        # the source and target are the identical network name.
 
1248
        text_stream = self.from_repository.texts.get_record_stream(
 
1249
                        self._text_keys, self._text_fetch_order, False)
 
1250
        return ('texts', text_stream)
 
1251
 
1243
1252
    def get_stream(self, search):
1244
1253
        def wrap_and_count(pb, rc, stream):
1245
1254
            """Yield records from stream while showing progress."""