Rev 5774: (jelmer) Move PackRepository.__init__ to KnitPackRepository.__init__ (Jelmer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Apr 8 16:42:24 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5774 [merge]
revision-id: pqm at pqm.ubuntu.com-20110408164023-4t8mlpiha78ql802
parent: pqm at pqm.ubuntu.com-20110408150331-pc8lu2zpvce2qw7f
parent: jelmer at samba.org-20110405231412-9y0fn1ym2tepj1q7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-04-08 16:40:23 +0000
message:
(jelmer) Move PackRepository.__init__ to KnitPackRepository.__init__ (Jelmer
Vernooij)
modified:
bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-1
bzrlib/repofmt/knitpack_repo.py knitpack_repo.py-20110405143430-6p75yrk99v6pb770-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py 2011-04-05 15:07:09 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py 2011-04-05 15:34:09 +0000
@@ -837,9 +837,8 @@
def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
_serializer):
"""Overridden to change pack collection class."""
- PackRepository.__init__(self, _format, a_bzrdir, control_files,
+ super(CHKInventoryRepository, self).__init__(_format, a_bzrdir, control_files,
_commit_builder_class, _serializer)
- # and now replace everything it did :)
index_transport = self._transport.clone('indices')
self._pack_collection = GCRepositoryPackCollection(self,
self._transport, index_transport,
=== modified file 'bzrlib/repofmt/knitpack_repo.py'
--- a/bzrlib/repofmt/knitpack_repo.py 2011-04-05 23:13:55 +0000
+++ b/bzrlib/repofmt/knitpack_repo.py 2011-04-05 23:14:12 +0000
@@ -43,12 +43,16 @@
GraphIndexPrefixAdapter,
InMemoryGraphIndex,
)
+from bzrlib.repofmt.knitrepo import (
+ KnitRepository,
+ )
from bzrlib.repofmt.pack_repo import (
RepositoryFormatPack,
Packer,
PackCommitBuilder,
PackRepository,
PackRootCommitBuilder,
+ RepositoryPackCollection,
)
from bzrlib.repository import (
StreamSource,
@@ -57,6 +61,59 @@
class KnitPackRepository(PackRepository):
+ def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
+ _serializer):
+ KnitRepository.__init__(self, _format, a_bzrdir, control_files,
+ _commit_builder_class, _serializer)
+ if self._format.supports_chks:
+ raise AssertionError("chk not supported")
+ index_transport = self._transport.clone('indices')
+ self._pack_collection = RepositoryPackCollection(self, self._transport,
+ index_transport,
+ self._transport.clone('upload'),
+ self._transport.clone('packs'),
+ _format.index_builder_class,
+ _format.index_class,
+ use_chk_index=self._format.supports_chks,
+ )
+ self.inventories = KnitVersionedFiles(
+ _KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
+ add_callback=self._pack_collection.inventory_index.add_callback,
+ deltas=True, parents=True, is_locked=self.is_locked),
+ data_access=self._pack_collection.inventory_index.data_access,
+ max_delta_chain=200)
+ self.revisions = KnitVersionedFiles(
+ _KnitGraphIndex(self._pack_collection.revision_index.combined_index,
+ add_callback=self._pack_collection.revision_index.add_callback,
+ deltas=False, parents=True, is_locked=self.is_locked,
+ track_external_parent_refs=True),
+ data_access=self._pack_collection.revision_index.data_access,
+ max_delta_chain=0)
+ self.signatures = KnitVersionedFiles(
+ _KnitGraphIndex(self._pack_collection.signature_index.combined_index,
+ add_callback=self._pack_collection.signature_index.add_callback,
+ deltas=False, parents=False, is_locked=self.is_locked),
+ data_access=self._pack_collection.signature_index.data_access,
+ max_delta_chain=0)
+ self.texts = KnitVersionedFiles(
+ _KnitGraphIndex(self._pack_collection.text_index.combined_index,
+ add_callback=self._pack_collection.text_index.add_callback,
+ deltas=True, parents=True, is_locked=self.is_locked),
+ data_access=self._pack_collection.text_index.data_access,
+ max_delta_chain=200)
+ self.chk_bytes = None
+ # True when the repository object is 'write locked' (as opposed to the
+ # physical lock only taken out around changes to the pack-names list.)
+ # Another way to represent this would be a decorator around the control
+ # files object that presents logical locks as physical ones - if this
+ # gets ugly consider that alternative design. RBC 20071011
+ self._write_lock_count = 0
+ self._transaction = None
+ # for tests
+ self._reconcile_does_inventory_gc = True
+ self._reconcile_fixes_text_parents = True
+ self._reconcile_backsup_inventory = False
+
def _get_source(self, to_format):
if to_format.network_name() == self._format.network_name():
return KnitPackStreamSource(self, to_format)
@@ -490,14 +547,25 @@
yield self._get_text_stream()
-class KnitReconcilePacker(Packer):
+class KnitPacker(Packer):
+ """Packer that works with knit packs."""
+
+ def __init__(self, pack_collection, packs, suffix, revision_ids=None,
+ reload_func=None):
+ super(KnitPacker, self).__init__(pack_collection, packs, suffix,
+ revision_ids=revision_ids,
+ reload_func=reload_func)
+
+
+class KnitReconcilePacker(KnitPacker):
"""A packer which regenerates indices etc as it copies.
This is used by ``bzr reconcile`` to cause parent text pointers to be
regenerated.
"""
- def _extra_init(self):
+ def __init__(self, *args, **kwargs):
+ super(KnitReconcilePacker, self).__init__(*args, **kwargs)
self._data_changed = False
def _process_inventory_lines(self, inv_lines):
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2011-04-08 15:03:31 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2011-04-08 16:40:23 +0000
@@ -40,7 +40,6 @@
from bzrlib.knit import (
KnitPlainFactory,
KnitVersionedFiles,
- _KnitGraphIndex,
_DirectPackAccess,
)
""")
@@ -663,10 +662,6 @@
# What text keys to copy. None for 'all texts'. This is set by
# _copy_inventory_texts
self._text_filter = None
- self._extra_init()
-
- def _extra_init(self):
- """A template hook to allow extending the constructor trivially."""
def _pack_map_and_index_list(self, index_attribute):
"""Convert a list of packs to an index pack map and index list.
@@ -2074,7 +2069,7 @@
===================================================
Tuple based apis below, string based, and key based apis above
---------------------------------------------------
- KnitVersionedFiles
+ VersionedFiles
Provides .texts, .revisions etc
This adapts the N-tuple keys to physical knit records which only have a
single string identifier (for historical reasons), which in older formats
@@ -2090,68 +2085,6 @@
"""
- def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
- _serializer):
- KnitRepository.__init__(self, _format, a_bzrdir, control_files,
- _commit_builder_class, _serializer)
- index_transport = self._transport.clone('indices')
- self._pack_collection = RepositoryPackCollection(self, self._transport,
- index_transport,
- self._transport.clone('upload'),
- self._transport.clone('packs'),
- _format.index_builder_class,
- _format.index_class,
- use_chk_index=self._format.supports_chks,
- )
- self.inventories = KnitVersionedFiles(
- _KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
- add_callback=self._pack_collection.inventory_index.add_callback,
- deltas=True, parents=True, is_locked=self.is_locked),
- data_access=self._pack_collection.inventory_index.data_access,
- max_delta_chain=200)
- self.revisions = KnitVersionedFiles(
- _KnitGraphIndex(self._pack_collection.revision_index.combined_index,
- add_callback=self._pack_collection.revision_index.add_callback,
- deltas=False, parents=True, is_locked=self.is_locked,
- track_external_parent_refs=True),
- data_access=self._pack_collection.revision_index.data_access,
- max_delta_chain=0)
- self.signatures = KnitVersionedFiles(
- _KnitGraphIndex(self._pack_collection.signature_index.combined_index,
- add_callback=self._pack_collection.signature_index.add_callback,
- deltas=False, parents=False, is_locked=self.is_locked),
- data_access=self._pack_collection.signature_index.data_access,
- max_delta_chain=0)
- self.texts = KnitVersionedFiles(
- _KnitGraphIndex(self._pack_collection.text_index.combined_index,
- add_callback=self._pack_collection.text_index.add_callback,
- deltas=True, parents=True, is_locked=self.is_locked),
- data_access=self._pack_collection.text_index.data_access,
- max_delta_chain=200)
- if _format.supports_chks:
- # No graph, no compression:- references from chks are between
- # different objects not temporal versions of the same; and without
- # some sort of temporal structure knit compression will just fail.
- self.chk_bytes = KnitVersionedFiles(
- _KnitGraphIndex(self._pack_collection.chk_index.combined_index,
- add_callback=self._pack_collection.chk_index.add_callback,
- deltas=False, parents=False, is_locked=self.is_locked),
- data_access=self._pack_collection.chk_index.data_access,
- max_delta_chain=0)
- else:
- self.chk_bytes = None
- # True when the repository object is 'write locked' (as opposed to the
- # physical lock only taken out around changes to the pack-names list.)
- # Another way to represent this would be a decorator around the control
- # files object that presents logical locks as physical ones - if this
- # gets ugly consider that alternative design. RBC 20071011
- self._write_lock_count = 0
- self._transaction = None
- # for tests
- self._reconcile_does_inventory_gc = True
- self._reconcile_fixes_text_parents = True
- self._reconcile_backsup_inventory = False
-
def _abort_write_group(self):
self.revisions._index._key_dependencies.clear()
self._pack_collection._abort_write_group()
More information about the bazaar-commits
mailing list