Rev 3749: (robertc) Connect the BTree index layer up to a pack based repository in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sun Sep 28 00:38:13 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3749
revision-id: pqm at pqm.ubuntu.com-20080927233809-mlgk5zkwowkb8q8z
parent: pqm at pqm.ubuntu.com-20080927040426-dv3yctm2h2fd2bzf
parent: robertc at robertcollins.net-20080927225834-030vklra0bu3f0bc
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2008-09-28 00:38:09 +0100
message:
(robertc) Connect the BTree index layer up to a pack based repository
format. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
------------------------------------------------------------
revno: 3735.1.3
revision-id: robertc at robertcollins.net-20080927225834-030vklra0bu3f0bc
parent: robertc at robertcollins.net-20080925222509-1cpsw55esrjycw9e
parent: pqm at pqm.ubuntu.com-20080927040426-dv3yctm2h2fd2bzf
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Sun 2008-09-28 08:58:34 +1000
message:
Resolve NEWS.
removed:
bzrlib/_walkdirs_win32.h _walkdirs_win32.h-20080716220454-kweh3tgxez5dvw2l-1
added:
bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
doc/developers/lca_tree_merging.txt lca_merge_resolution-20080731173903-8ku77uz7o6smd3jj-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
bzrlib/_dirstate_helpers_py.py _dirstate_helpers_py-20070710145033-90nz6cqglsk150jy-1
bzrlib/_patiencediff_c.c _patiencediff_c.c-20070721205602-q3imkipwlgagp3cy-1
bzrlib/_walkdirs_win32.pyx _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
bzrlib/branchbuilder.py branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/delta.py delta.py-20050729221636-54cf14ef94783d0a
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/memorytree.py memorytree.py-20060906023413-4wlkalbdpsxi2r4y-1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/mutabletree.py mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
bzrlib/python-compat.h pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
bzrlib/tests/test_dirstate.py test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
bzrlib/tests/tree_implementations/test_tree.py test_tree.py-20061215160206-usu7lwcj8aq2n3br-1
bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/http/wsgi.py wsgi.py-20061005091552-rz8pva0olkxv0sd8-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
doc/en/user-guide/http_smart_server.txt fastcgi.txt-20061005091552-rz8pva0olkxv0sd8-3
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3735.1.2
revision-id: robertc at robertcollins.net-20080925222509-1cpsw55esrjycw9e
parent: robertc at robertcollins.net-20080925055104-wgdloa74hy8c2l3j
committer: Robert Collins <robertc at robertcollins.net>
branch nick: btree-repo
timestamp: Fri 2008-09-26 08:25:09 +1000
message:
Remove 1.5 series dev formats and document development2 a little better.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
------------------------------------------------------------
revno: 3735.1.1
revision-id: robertc at robertcollins.net-20080925055104-wgdloa74hy8c2l3j
parent: pqm at pqm.ubuntu.com-20080925012144-k71s2olv2fpy771x
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-09-25 15:51:04 +1000
message:
Add development2 formats using BTree indices.
modified:
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'NEWS'
--- a/NEWS 2008-09-27 04:04:26 +0000
+++ b/NEWS 2008-09-27 22:58:34 +0000
@@ -109,6 +109,11 @@
of a file if it is likely to be needed in determining the output
of iter_changes. (Robert Collins)
+ * The PackRepository, RepositoryPackCollection, NewPack classes have a
+ slightly changed interface to support different index types; as a
+ result other users of these classes need to supply the index types
+ they want. (Robert Collins)
+
TESTING:
* ``bzrlib.tests.repository_implementations`` has been renamed to
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-09-23 02:16:55 +0000
+++ b/bzrlib/branch.py 2008-09-25 22:25:09 +0000
@@ -36,7 +36,7 @@
urlutils,
)
from bzrlib.config import BranchConfig
-from bzrlib.repofmt.pack_repo import RepositoryFormatPackDevelopment1Subtree
+from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack5RichRoot
from bzrlib.tag import (
BasicTags,
DisabledTags,
@@ -1346,7 +1346,7 @@
def __init__(self):
super(BzrBranchFormat7, self).__init__()
self._matchingbzrdir.repository_format = \
- RepositoryFormatPackDevelopment1Subtree()
+ RepositoryFormatKnitPack5RichRoot()
def supports_stacking(self):
return True
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2008-09-26 22:21:21 +0000
+++ b/bzrlib/bzrdir.py 2008-09-27 22:58:34 +0000
@@ -3055,7 +3055,7 @@
)
# The following two formats should always just be aliases.
format_registry.register_metadir('development',
- 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
help='Current development format. Can convert data to and from pack-0.92 '
'(and anything compatible with pack-0.92) format repositories. '
'Repositories and branches in this format can only be read by bzr.dev. '
@@ -3068,7 +3068,7 @@
alias=True,
)
format_registry.register_metadir('development-subtree',
- 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
help='Current development format, subtree variant. Can convert data to and '
'from pack-0.92-subtree (and anything compatible with '
'pack-0.92-subtree) format repositories. Repositories and branches in '
@@ -3080,10 +3080,10 @@
experimental=True,
alias=True,
)
-# And the development formats which the will have aliased one of follow:
-format_registry.register_metadir('development1',
- 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
- help='A branch and pack based repository that supports stacking. '
+# And the development formats above will have aliased one of the following:
+format_registry.register_metadir('development2',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
+ help='1.6.1 with B+Tree based index. '
'Please read '
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
'before use.',
@@ -3092,9 +3092,9 @@
hidden=True,
experimental=True,
)
-format_registry.register_metadir('development1-subtree',
- 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree',
- help='A branch and pack based repository that supports stacking. '
+format_registry.register_metadir('development2-subtree',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
+ help='1.6.1-subtree with B+Tree based index. '
'Please read '
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
'before use.',
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2008-09-26 20:28:24 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2008-09-27 22:58:34 +0000
@@ -28,9 +28,6 @@
ui,
)
from bzrlib.index import (
- GraphIndex,
- GraphIndexBuilder,
- InMemoryGraphIndex,
CombinedGraphIndex,
GraphIndexPrefixAdapter,
)
@@ -55,6 +52,14 @@
)
from bzrlib.decorators import needs_write_lock
+from bzrlib.btree_index import (
+ BTreeGraphIndex,
+ BTreeBuilder,
+ )
+from bzrlib.index import (
+ GraphIndex,
+ InMemoryGraphIndex,
+ )
from bzrlib.repofmt.knitrepo import KnitRepository
from bzrlib.repository import (
CommitBuilder,
@@ -216,7 +221,8 @@
}
def __init__(self, upload_transport, index_transport, pack_transport,
- upload_suffix='', file_mode=None):
+ upload_suffix='', file_mode=None, index_builder_class=None,
+ index_class=None):
"""Create a NewPack instance.
:param upload_transport: A writable transport for the pack to be
@@ -229,24 +235,30 @@
:param upload_suffix: An optional suffix to be given to any temporary
files created during the pack creation. e.g '.autopack'
:param file_mode: An optional file mode to create the new files with.
+ :param index_builder_class: Required keyword parameter - the class of
+ index builder to use.
+ :param index_class: Required keyword parameter - the class of index
+ object to use.
"""
# The relative locations of the packs are constrained, but all are
# passed in because the caller has them, so as to avoid object churn.
Pack.__init__(self,
# Revisions: parents list, no text compression.
- InMemoryGraphIndex(reference_lists=1),
+ index_builder_class(reference_lists=1),
# Inventory: We want to map compression only, but currently the
# knit code hasn't been updated enough to understand that, so we
# have a regular 2-list index giving parents and compression
# source.
- InMemoryGraphIndex(reference_lists=2),
+ index_builder_class(reference_lists=2),
# Texts: compression and per file graph, for all fileids - so two
# reference lists and two elements in the key tuple.
- InMemoryGraphIndex(reference_lists=2, key_elements=2),
+ index_builder_class(reference_lists=2, key_elements=2),
# Signatures: Just blobs to store, no compression, no parents
# listing.
- InMemoryGraphIndex(reference_lists=0),
+ index_builder_class(reference_lists=0),
)
+ # When we make readonly indices, we need this.
+ self.index_class = index_class
# where should the new pack be opened
self.upload_transport = upload_transport
# where are indices written out to
@@ -393,7 +405,7 @@
def _replace_index_with_readonly(self, index_type):
setattr(self, index_type + '_index',
- GraphIndex(self.index_transport,
+ self.index_class(self.index_transport,
self.index_name(index_type, self.name),
self.index_sizes[self.index_offset(index_type)]))
@@ -592,7 +604,9 @@
return NewPack(self._pack_collection._upload_transport,
self._pack_collection._index_transport,
self._pack_collection._pack_transport, upload_suffix=self.suffix,
- file_mode=self._pack_collection.repo.bzrdir._get_file_mode())
+ file_mode=self._pack_collection.repo.bzrdir._get_file_mode(),
+ index_builder_class=self._pack_collection._index_builder_class,
+ index_class=self._pack_collection._index_class)
def _copy_revision_texts(self):
"""Copy revision data to the new pack."""
@@ -1105,7 +1119,7 @@
"""
def __init__(self, repo, transport, index_transport, upload_transport,
- pack_transport):
+ pack_transport, index_builder_class, index_class):
"""Create a new RepositoryPackCollection.
:param transport: Addresses the repository base directory
@@ -1114,12 +1128,16 @@
:param upload_transport: Addresses the directory into which packs are written
while they're being created.
:param pack_transport: Addresses the directory of existing complete packs.
+ :param index_builder_class: The index builder class to use.
+ :param index_class: The index class to use.
"""
self.repo = repo
self.transport = transport
self._index_transport = index_transport
self._upload_transport = upload_transport
self._pack_transport = pack_transport
+ self._index_builder_class = index_builder_class
+ self._index_class = index_class
self._suffix_offsets = {'.rix': 0, '.iix': 1, '.tix': 2, '.six': 3}
self.packs = []
# name:Pack mapping
@@ -1370,14 +1388,14 @@
detect updates from others during our write operation.
:return: An iterator of the index contents.
"""
- return GraphIndex(self.transport, 'pack-names', None
+ return self._index_class(self.transport, 'pack-names', None
).iter_all_entries()
def _make_index(self, name, suffix):
size_offset = self._suffix_offsets[suffix]
index_name = name + suffix
index_size = self._names[name][size_offset]
- return GraphIndex(
+ return self._index_class(
self._index_transport, index_name, index_size)
def _max_pack_count(self, total_revisions):
@@ -1546,7 +1564,7 @@
"""
self.lock_names()
try:
- builder = GraphIndexBuilder()
+ builder = self._index_builder_class()
# load the disk nodes across
disk_nodes = set()
for index, key, value in self._iter_disk_pack_index():
@@ -1618,7 +1636,9 @@
raise errors.NotWriteLocked(self)
self._new_pack = NewPack(self._upload_transport, self._index_transport,
self._pack_transport, upload_suffix='.pack',
- file_mode=self.repo.bzrdir._get_file_mode())
+ file_mode=self.repo.bzrdir._get_file_mode(),
+ index_builder_class=self._index_builder_class,
+ index_class=self._index_class)
# allow writing: queue writes to a new index
self.revision_index.add_writable_index(self._new_pack.revision_index,
self._new_pack)
@@ -1693,7 +1713,9 @@
self._pack_collection = RepositoryPackCollection(self, self._transport,
index_transport,
self._transport.clone('upload'),
- self._transport.clone('packs'))
+ self._transport.clone('packs'),
+ _format.index_builder_class,
+ _format.index_class)
self.inventories = KnitVersionedFiles(
_KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
add_callback=self._pack_collection.inventory_index.add_callback,
@@ -1917,6 +1939,9 @@
_serializer = None
# External references are not supported in pack repositories yet.
supports_external_lookups = False
+ # What index classes to use
+ index_builder_class = None
+ index_class = None
def initialize(self, a_bzrdir, shared=False):
"""Create a pack based repository.
@@ -1928,7 +1953,7 @@
"""
mutter('creating repository in %s.', a_bzrdir.transport.base)
dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
- builder = GraphIndexBuilder()
+ builder = self.index_builder_class()
files = [('pack-names', builder.finish())]
utf8_files = [('format', self.get_format_string())]
@@ -1966,6 +1991,9 @@
repository_class = KnitPackRepository
_commit_builder_class = PackCommitBuilder
_serializer = xml5.serializer_v5
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir('pack-0.92')
@@ -2002,6 +2030,9 @@
rich_root_data = True
supports_tree_reference = True
_serializer = xml7.serializer_v7
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir(
@@ -2043,6 +2074,9 @@
rich_root_data = True
supports_tree_reference = False
_serializer = xml6.serializer_v6
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir(
@@ -2081,9 +2115,12 @@
_commit_builder_class = PackCommitBuilder
_serializer = xml5.serializer_v5
supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
- return bzrdir.format_registry.make_bzrdir('development1')
+ return bzrdir.format_registry.make_bzrdir('1.6')
def _ignore_setting_bzrdir(self, format):
pass
@@ -2117,6 +2154,9 @@
supports_tree_reference = False # no subtrees
_serializer = xml6.serializer_v6
supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir(
@@ -2160,10 +2200,13 @@
_serializer = xml7.serializer_v7
supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = InMemoryGraphIndex
+ index_class = GraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir(
- 'development1-subtree')
+ '1.6.1-rich-root')
def _ignore_setting_bzrdir(self, format):
pass
@@ -2184,22 +2227,24 @@
" (deprecated)")
-class RepositoryFormatPackDevelopment1(RepositoryFormatPack):
+class RepositoryFormatPackDevelopment2(RepositoryFormatPack):
"""A no-subtrees development repository.
- This format should be retained until the second release after bzr 1.5.
+ This format should be retained until the second release after bzr 1.7.
- Supports external lookups, which results in non-truncated ghosts after
- reconcile compared to pack-0.92 formats.
+ This is pack-1.6.1 with B+Tree indices.
"""
repository_class = KnitPackRepository
_commit_builder_class = PackCommitBuilder
_serializer = xml5.serializer_v5
supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = BTreeBuilder
+ index_class = BTreeGraphIndex
def _get_matching_bzrdir(self):
- return bzrdir.format_registry.make_bzrdir('development1')
+ return bzrdir.format_registry.make_bzrdir('development2')
def _ignore_setting_bzrdir(self, format):
pass
@@ -2208,24 +2253,23 @@
def get_format_string(self):
"""See RepositoryFormat.get_format_string()."""
- return "Bazaar development format 1 (needs bzr.dev from before 1.6)\n"
+ return "Bazaar development format 2 (needs bzr.dev from before 1.8)\n"
def get_format_description(self):
"""See RepositoryFormat.get_format_description()."""
return ("Development repository format, currently the same as "
- "pack-0.92 with external reference support.\n")
+ "1.6.1 with B+Trees.\n")
def check_conversion_target(self, target_format):
pass
-class RepositoryFormatPackDevelopment1Subtree(RepositoryFormatPack):
+class RepositoryFormatPackDevelopment2Subtree(RepositoryFormatPack):
"""A subtrees development repository.
- This format should be retained until the second release after bzr 1.5.
+ This format should be retained until the second release after bzr 1.7.
- Supports external lookups, which results in non-truncated ghosts after
- reconcile compared to pack-0.92 formats.
+ 1.6.1-subtree[as it might have been] with B+Tree indices.
"""
repository_class = KnitPackRepository
@@ -2234,10 +2278,13 @@
supports_tree_reference = True
_serializer = xml7.serializer_v7
supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = BTreeBuilder
+ index_class = BTreeGraphIndex
def _get_matching_bzrdir(self):
return bzrdir.format_registry.make_bzrdir(
- 'development1-subtree')
+ 'development2-subtree')
def _ignore_setting_bzrdir(self, format):
pass
@@ -2254,10 +2301,10 @@
def get_format_string(self):
"""See RepositoryFormat.get_format_string()."""
- return ("Bazaar development format 1 with subtree support "
- "(needs bzr.dev from before 1.6)\n")
+ return ("Bazaar development format 2 with subtree support "
+ "(needs bzr.dev from before 1.8)\n")
def get_format_description(self):
"""See RepositoryFormat.get_format_description()."""
return ("Development repository format, currently the same as "
- "pack-0.92-subtree with external reference support.\n")
+ "1.6.1-subtree with B+Tree indices.\n")
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-09-23 22:46:05 +0000
+++ b/bzrlib/repository.py 2008-09-27 22:58:34 +0000
@@ -2332,19 +2332,18 @@
)
# Development formats.
-# 1.5->1.6
-format_registry.register_lazy(
- "Bazaar development format 1 (needs bzr.dev from before 1.6)\n",
- 'bzrlib.repofmt.pack_repo',
- 'RepositoryFormatPackDevelopment1',
- )
-format_registry.register_lazy(
- ("Bazaar development format 1 with subtree support "
- "(needs bzr.dev from before 1.6)\n"),
- 'bzrlib.repofmt.pack_repo',
- 'RepositoryFormatPackDevelopment1Subtree',
- )
-# 1.6->1.7 go below here
+# 1.7->1.8 go below here
+format_registry.register_lazy(
+ "Bazaar development format 2 (needs bzr.dev from before 1.8)\n",
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment2',
+ )
+format_registry.register_lazy(
+ ("Bazaar development format 2 with subtree support "
+ "(needs bzr.dev from before 1.8)\n"),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment2Subtree',
+ )
class InterRepository(InterObject):
@@ -2928,13 +2927,13 @@
RepositoryFormatKnitPack4,
RepositoryFormatKnitPack5,
RepositoryFormatKnitPack5RichRoot,
- RepositoryFormatPackDevelopment1,
- RepositoryFormatPackDevelopment1Subtree,
+ RepositoryFormatPackDevelopment2,
+ RepositoryFormatPackDevelopment2Subtree,
)
norichroot = (
RepositoryFormatKnit1, # no rr, no subtree
RepositoryFormatKnitPack1, # no rr, no subtree
- RepositoryFormatPackDevelopment1, # no rr, no subtree
+ RepositoryFormatPackDevelopment2, # no rr, no subtree
RepositoryFormatKnitPack5, # no rr, no subtree
)
richroot = (
@@ -2942,7 +2941,7 @@
RepositoryFormatKnitPack3, # rr, subtree
RepositoryFormatKnitPack4, # rr, no subtree
RepositoryFormatKnitPack5RichRoot,# rr, no subtree
- RepositoryFormatPackDevelopment1Subtree, # rr, subtree
+ RepositoryFormatPackDevelopment2Subtree, # rr, subtree
)
for format in norichroot:
if format.rich_root_data:
=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py 2008-08-29 05:18:56 +0000
+++ b/bzrlib/tests/blackbox/test_info.py 2008-09-25 22:25:09 +0000
@@ -1376,13 +1376,13 @@
def test_info_stacked(self):
# We have a mainline
trunk_tree = self.make_branch_and_tree('mainline',
- format='development1')
+ format='1.6')
trunk_tree.commit('mainline')
# and a branch from it which is stacked
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
out, err = self.run_bzr('info newbranch')
self.assertEqual(
-"""Standalone tree (format: development1)
+"""Standalone tree (format: 1.6)
Location:
branch root: newbranch
=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py 2008-08-23 17:57:41 +0000
+++ b/bzrlib/tests/blackbox/test_push.py 2008-09-25 22:25:09 +0000
@@ -343,9 +343,9 @@
self.assertFalse(self.get_transport('published').has('.'))
def test_push_notifies_default_stacking(self):
- self.make_branch('stack_on', format='development1')
+ self.make_branch('stack_on', format='1.6')
self.make_bzrdir('.').get_config().set_default_stack_on('stack_on')
- self.make_branch('from', format='development1')
+ self.make_branch('from', format='1.6')
out, err = self.run_bzr('push -d from to')
self.assertContainsRe(err,
'Using default stacking branch stack_on at .*')
=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py 2008-09-02 15:28:44 +0000
+++ b/bzrlib/tests/test_bzrdir.py 2008-09-25 22:25:09 +0000
@@ -442,7 +442,7 @@
self.assertEqual(parent_bzrdir.root_transport.base,
repo_policy._stack_on_pwd)
- def prepare_default_stacking(self, child_format='development1'):
+ def prepare_default_stacking(self, child_format='1.6'):
parent_bzrdir = self.make_bzrdir('.')
child_branch = self.make_branch('child', format=child_format)
parent_bzrdir.get_config().set_default_stack_on(child_branch.base)
@@ -507,28 +507,28 @@
self.assertTrue(repo.supports_rich_root())
def test_add_fallback_repo_handles_absolute_urls(self):
- stack_on = self.make_branch('stack_on', format='development1')
- repo = self.make_repository('repo', format='development1')
+ stack_on = self.make_branch('stack_on', format='1.6')
+ repo = self.make_repository('repo', format='1.6')
policy = bzrdir.UseExistingRepository(repo, stack_on.base)
policy._add_fallback(repo)
def test_add_fallback_repo_handles_relative_urls(self):
- stack_on = self.make_branch('stack_on', format='development1')
- repo = self.make_repository('repo', format='development1')
+ stack_on = self.make_branch('stack_on', format='1.6')
+ repo = self.make_repository('repo', format='1.6')
policy = bzrdir.UseExistingRepository(repo, '.', stack_on.base)
policy._add_fallback(repo)
def test_configure_relative_branch_stacking_url(self):
- stack_on = self.make_branch('stack_on', format='development1')
- stacked = self.make_branch('stack_on/stacked', format='development1')
+ stack_on = self.make_branch('stack_on', format='1.6')
+ stacked = self.make_branch('stack_on/stacked', format='1.6')
policy = bzrdir.UseExistingRepository(stacked.repository,
'.', stack_on.base)
policy.configure_branch(stacked)
self.assertEqual('..', stacked.get_stacked_on_url())
def test_relative_branch_stacking_to_absolute(self):
- stack_on = self.make_branch('stack_on', format='development1')
- stacked = self.make_branch('stack_on/stacked', format='development1')
+ stack_on = self.make_branch('stack_on', format='1.6')
+ stacked = self.make_branch('stack_on/stacked', format='1.6')
policy = bzrdir.UseExistingRepository(stacked.repository,
'.', self.get_readonly_url('stack_on'))
policy.configure_branch(stacked)
=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py 2008-09-02 03:17:08 +0000
+++ b/bzrlib/tests/test_pack_repository.py 2008-09-25 22:25:09 +0000
@@ -22,7 +22,8 @@
from cStringIO import StringIO
from stat import S_ISDIR
-from bzrlib.index import GraphIndex, InMemoryGraphIndex
+from bzrlib.btree_index import BTreeGraphIndex
+from bzrlib.index import GraphIndex
from bzrlib import (
bzrdir,
errors,
@@ -111,7 +112,7 @@
self.assertFalse(t.has('knits'))
# revision-indexes file-container directory
self.assertEqual([],
- list(GraphIndex(t, 'pack-names', None).iter_all_entries()))
+ list(self.index_class(t, 'pack-names', None).iter_all_entries()))
self.assertTrue(S_ISDIR(t.stat('packs').st_mode))
self.assertTrue(S_ISDIR(t.stat('upload').st_mode))
self.assertTrue(S_ISDIR(t.stat('indices').st_mode))
@@ -152,9 +153,9 @@
tree = self.make_branch_and_tree('.', format=format)
trans = tree.branch.repository.bzrdir.get_repository_transport(None)
self.assertEqual([],
- list(GraphIndex(trans, 'pack-names', None).iter_all_entries()))
+ list(self.index_class(trans, 'pack-names', None).iter_all_entries()))
tree.commit('foobarbaz')
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
index_nodes = list(index.iter_all_entries())
self.assertEqual(1, len(index_nodes))
node = index_nodes[0]
@@ -173,7 +174,7 @@
tree1.branch.repository.fetch(tree2.branch.repository)
trans = tree1.branch.repository.bzrdir.get_repository_transport(None)
self.assertEqual([],
- list(GraphIndex(trans, 'pack-names', None).iter_all_entries()))
+ list(self.index_class(trans, 'pack-names', None).iter_all_entries()))
def test_commit_across_pack_shape_boundary_autopacks(self):
format = self.get_format()
@@ -187,14 +188,14 @@
for x in range(9):
tree.commit('commit %s' % x)
# there should be 9 packs:
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(9, len(list(index.iter_all_entries())))
# insert some files in obsolete_packs which should be removed by pack.
trans.put_bytes('obsolete_packs/foo', '123')
trans.put_bytes('obsolete_packs/bar', '321')
# committing one more should coalesce to 1 of 10.
tree.commit('commit triggering pack')
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(1, len(list(index.iter_all_entries())))
# packing should not damage data
tree = tree.bzrdir.open_workingtree()
@@ -210,7 +211,7 @@
large_pack_name = list(index.iter_all_entries())[0][1][0]
# finally, committing again should not touch the large pack.
tree.commit('commit not triggering pack')
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(2, len(list(index.iter_all_entries())))
pack_names = [node[1][0] for node in index.iter_all_entries()]
self.assertTrue(large_pack_name in pack_names)
@@ -239,7 +240,7 @@
tree.commit('more work')
tree.branch.repository.pack()
# there should be 1 pack:
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(1, len(list(index.iter_all_entries())))
self.assertEqual(2, len(tree.branch.repository.all_revision_ids()))
@@ -581,11 +582,11 @@
for x in range(9):
tree.commit('commit %s' % x)
# there should be 9 packs:
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(9, len(list(index.iter_all_entries())))
# committing one more should coalesce to 1 of 10.
tree.commit('commit triggering pack')
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(1, len(list(index.iter_all_entries())))
# packing should not damage data
tree = tree.bzrdir.open_workingtree()
@@ -601,7 +602,7 @@
large_pack_name = list(index.iter_all_entries())[0][1][0]
# finally, committing again should not touch the large pack.
tree.commit('commit not triggering pack')
- index = GraphIndex(trans, 'pack-names', None)
+ index = self.index_class(trans, 'pack-names', None)
self.assertEqual(2, len(list(index.iter_all_entries())))
pack_names = [node[1][0] for node in index.iter_all_entries()]
self.assertTrue(large_pack_name in pack_names)
@@ -613,26 +614,32 @@
scenarios_params = [
dict(format_name='pack-0.92',
format_string="Bazaar pack repository format 1 (needs bzr 0.92)\n",
- format_supports_external_lookups=False),
+ format_supports_external_lookups=False,
+ index_class=GraphIndex),
dict(format_name='pack-0.92-subtree',
format_string="Bazaar pack repository format 1 "
"with subtree support (needs bzr 0.92)\n",
- format_supports_external_lookups=False),
+ format_supports_external_lookups=False,
+ index_class=GraphIndex),
dict(format_name='1.6',
format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
- format_supports_external_lookups=True),
+ format_supports_external_lookups=True,
+ index_class=GraphIndex),
dict(format_name='1.6.1-rich-root',
format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
"(bzr 1.6.1)\n",
- format_supports_external_lookups=True),
- dict(format_name='development',
- format_string="Bazaar development format 1 "
- "(needs bzr.dev from before 1.6)\n",
- format_supports_external_lookups=True),
- dict(format_name='development-subtree',
- format_string="Bazaar development format 1 "
- "with subtree support (needs bzr.dev from before 1.6)\n",
- format_supports_external_lookups=True),
+ format_supports_external_lookups=True,
+ index_class=GraphIndex),
+ dict(format_name='development2',
+ format_string="Bazaar development format 2 "
+ "(needs bzr.dev from before 1.8)\n",
+ format_supports_external_lookups=True,
+ index_class=BTreeGraphIndex),
+ dict(format_name='development2-subtree',
+ format_string="Bazaar development format 2 "
+ "with subtree support (needs bzr.dev from before 1.8)\n",
+ format_supports_external_lookups=True,
+ index_class=BTreeGraphIndex),
]
adapter = tests.TestScenarioApplier()
# name of the scenario is the format name
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2008-09-19 15:47:46 +0000
+++ b/bzrlib/tests/test_repository.py 2008-09-27 22:58:34 +0000
@@ -33,6 +33,7 @@
UnsupportedFormatError,
)
from bzrlib import graph
+from bzrlib.btree_index import BTreeBuilder, BTreeGraphIndex
from bzrlib.index import GraphIndex, InMemoryGraphIndex
from bzrlib.repository import RepositoryFormat
from bzrlib.smart import server
@@ -976,9 +977,10 @@
index_transport = self.get_transport('index')
upload_transport.mkdir('.')
pack = pack_repo.NewPack(upload_transport, index_transport,
- pack_transport)
- self.assertIsInstance(pack.revision_index, InMemoryGraphIndex)
- self.assertIsInstance(pack.inventory_index, InMemoryGraphIndex)
+ pack_transport, index_builder_class=BTreeBuilder,
+ index_class=BTreeGraphIndex)
+ self.assertIsInstance(pack.revision_index, BTreeBuilder)
+ self.assertIsInstance(pack.inventory_index, BTreeBuilder)
self.assertIsInstance(pack._hash, type(md5.new()))
self.assertTrue(pack.upload_transport is upload_transport)
self.assertTrue(pack.index_transport is index_transport)
=== modified file 'doc/developers/development-repo.txt'
--- a/doc/developers/development-repo.txt 2008-08-28 06:26:43 +0000
+++ b/doc/developers/development-repo.txt 2008-09-25 22:25:09 +0000
@@ -226,17 +226,18 @@
development
-----------
-Currently an alias for Development1
+Currently an alias for Development2
development-subtree
-------------------
-Currently an alias for Development1Subtree
+Currently an alias for Development2Subtree
-Development1[Subtree]
+Development2[Subtree]
---------------------
-These formats were introduced during the development of branch stacking.
+These formats use B+Tree indices which are considerably faster than
+the earlier indices in bzr.
..
More information about the bazaar-commits
mailing list