Rev 3: init-repo now works. in http://bzr.arbash-meinel.com/plugins/xdelta_repo
John Arbash Meinel
john at arbash-meinel.com
Fri Feb 20 20:13:06 GMT 2009
At http://bzr.arbash-meinel.com/plugins/xdelta_repo
------------------------------------------------------------
revno: 3
revision-id: john at arbash-meinel.com-20090220201243-ga4w1zg55m3z3f4j
parent: john at arbash-meinel.com-20090220195818-r2u0w445n9qa9cmx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xdelta_repo
timestamp: Fri 2009-02-20 14:12:43 -0600
message:
init-repo now works.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2009-02-20 19:58:18 +0000
+++ b/__init__.py 2009-02-20 20:12:43 +0000
@@ -29,9 +29,9 @@
# want to register things.
from bzrlib.bzrdir import format_registry
from bzrlib.repository import format_registry as repo_registry
- format_registry.register_metadir('xd',
- 'bzrlib.plugins.xdelta_repo.repofmt.RepositoryFormatPackXDelta',
- help='pack-0.92 with btree index and xdelta. '
+ format_registry.register_metadir('dev-xdelta',
+ 'bzrlib.plugins.xdelta_repo.xdelta_repo.RepositoryFormatPackXDelta',
+ help='1.9 with xdelta. '
'Please read '
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
'before use.',
@@ -43,7 +43,7 @@
repo_registry.register_lazy(
'Bazaar development format - btree+xdelta (needs bzr.dev from 1.13)\n',
- 'bzrlib.plugins.groupcompress.repofmt',
+ 'bzrlib.plugins.xdelta_repo.xdelta_repo',
'RepositoryFormatPackXDelta',
)
=== modified file 'xdelta_repo.py'
--- a/xdelta_repo.py 2009-02-20 19:58:18 +0000
+++ b/xdelta_repo.py 2009-02-20 20:12:43 +0000
@@ -31,6 +31,8 @@
)
from bzrlib.repofmt import pack_repo
+chk_support = False
+
def _parse(bytes):
header, label_line, sha1_line, text_bytes = bytes.split('\n', 3)
@@ -558,3 +560,105 @@
versioned_files.writer.end()
versioned_files.stream.close()
+
+class XDeltaPackRepository(pack_repo.KnitPackRepository):
+ """XDelta customisation of KnitPackRepository."""
+
+ def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
+ _serializer):
+ """Overridden to change pack collection class."""
+ pack_repo.KnitPackRepository.__init__(self, _format, a_bzrdir,
+ control_files,
+ _commit_builder_class,
+ _serializer)
+ # and now replace everything it did :)
+ index_transport = self._transport.clone('indices')
+ if chk_support:
+ self._pack_collection = pack_repo.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,
+ )
+ else:
+ self._pack_collection = pack_repo.RepositoryPackCollection(self,
+ self._transport, index_transport,
+ self._transport.clone('upload'),
+ self._transport.clone('packs'),
+ _format.index_builder_class,
+ _format.index_class)
+ self.inventories = XDeltaVersionedFiles(
+ _XDeltaIndex(self._pack_collection.inventory_index.combined_index,
+ add_callback=self._pack_collection.inventory_index.add_callback,
+ parents=True, is_locked=self.is_locked),
+ access=self._pack_collection.inventory_index.data_access)
+ self.revisions = XDeltaVersionedFiles(
+ _XDeltaIndex(self._pack_collection.revision_index.combined_index,
+ add_callback=self._pack_collection.revision_index.add_callback,
+ parents=True, is_locked=self.is_locked),
+ access=self._pack_collection.revision_index.data_access,
+ delta=False)
+ self.signatures = XDeltaVersionedFiles(
+ _XDeltaIndex(self._pack_collection.signature_index.combined_index,
+ add_callback=self._pack_collection.signature_index.add_callback,
+ parents=False, is_locked=self.is_locked),
+ access=self._pack_collection.signature_index.data_access,
+ delta=False)
+ self.texts = XDeltaVersionedFiles(
+ _XDeltaIndex(self._pack_collection.text_index.combined_index,
+ add_callback=self._pack_collection.text_index.add_callback,
+ parents=True, is_locked=self.is_locked),
+ access=self._pack_collection.text_index.data_access)
+ if chk_support and _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 = XDeltaVersionedFiles(
+ _XDeltaIndex(self._pack_collection.chk_index.combined_index,
+ add_callback=self._pack_collection.chk_index.add_callback,
+ parents=False, is_locked=self.is_locked),
+ access=self._pack_collection.chk_index.data_access)
+ 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
+ # Note: We cannot unpack a delta that references a text we haven't seen
+ # yet. There are 2 options, work in fulltexts, or require
+ # topological sorting. Using fulltexts is more optimal for local
+ # operations, because the source can be smart about extracting
+ # multiple in-a-row (and sharing strings). Topological is better
+ # for remote, because we access less data.
+ self._fetch_order = 'topological'
+ self._fetch_uses_deltas = False
+
+
+class RepositoryFormatPackXDelta(pack_repo.RepositoryFormatKnitPack6):
+ """A B+Tree index using pack repository."""
+
+ repository_class = XDeltaPackRepository
+
+ def _get_matching_bzrdir(self):
+ return bzrdir.format_registry.make_bzrdir('dev-xdelta')
+
+ def get_format_string(self):
+ """See RepositoryFormat.get_format_string()."""
+ return ("Bazaar development format - btree+xdelta"
+ " (needs bzr.dev from 1.13)\n")
+
+ def get_format_description(self):
+ """See RepositoryFormat.get_format_description()."""
+ return ("Development repository format - btree+xdelta,"
+ " interoperates with pack-0.92\n")
+
+
More information about the bazaar-commits
mailing list