Rev 5089: Rename everything over to 'PackCollection'. in http://bzr.arbash-meinel.com/branches/bzr/lp/2.2.0b2-contained-pack
John Arbash Meinel
john at arbash-meinel.com
Fri Mar 5 20:55:48 GMT 2010
At http://bzr.arbash-meinel.com/branches/bzr/lp/2.2.0b2-contained-pack
------------------------------------------------------------
revno: 5089
revision-id: john at arbash-meinel.com-20100305205514-6mc90bgiikaarsjd
parent: john at arbash-meinel.com-20100305200410-xnbelm0j3u7ew7xy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.2.0b2-contained-pack
timestamp: Fri 2010-03-05 14:55:14 -0600
message:
Rename everything over to 'PackCollection'.
-------------- next part --------------
=== renamed file 'bzrlib/sack.py' => 'bzrlib/pack_collection.py'
--- a/bzrlib/sack.py 2010-03-05 20:04:10 +0000
+++ b/bzrlib/pack_collection.py 2010-03-05 20:55:14 +0000
@@ -149,25 +149,4 @@
This is used to aggregate indices across separate pack files into a
single meta-index. (eg 'pack-names').
"""
-
-
-class Sack(object):
- """A self-contained pack file.
-
- The content is fairly similar to a regular 'pack' file, except the indexes
- are written to then end of the file. The whole file is thus
- self-describing, and but must be read backwards. For improved performance,
- it is recommended that you store the locations of the indices in
- yet-another index across the various sacks. (similar to how pack-names
- stores the length of indexes and pack files.)
-
- The basic structure is::
-
- | blob-content | index1 | index2 | tail-index |
-
- The individual indexes are likely to just be a BTreeGraphIndex, the
- tail-index is a simplified descriptor defining where to find the other
- indices.
- """
-
- # TODO: Rename this to IndexedPack or something like that
+ # return SectionInfoSerializer().to_bytes(self._sections)
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2010-03-04 21:18:02 +0000
+++ b/bzrlib/tests/__init__.py 2010-03-05 20:55:14 +0000
@@ -3696,6 +3696,7 @@
'bzrlib.tests.test_osutils',
'bzrlib.tests.test_osutils_encodings',
'bzrlib.tests.test_pack',
+ 'bzrlib.tests.test_pack_collection',
'bzrlib.tests.test_patch',
'bzrlib.tests.test_patches',
'bzrlib.tests.test_permissions',
@@ -3714,7 +3715,6 @@
'bzrlib.tests.test_revisiontree',
'bzrlib.tests.test_rio',
'bzrlib.tests.test_rules',
- 'bzrlib.tests.test_sack',
'bzrlib.tests.test_sampler',
'bzrlib.tests.test_script',
'bzrlib.tests.test_selftest',
=== renamed file 'bzrlib/tests/test_sack.py' => 'bzrlib/tests/test_pack_collection.py'
--- a/bzrlib/tests/test_sack.py 2010-03-05 20:03:18 +0000
+++ b/bzrlib/tests/test_pack_collection.py 2010-03-05 20:55:14 +0000
@@ -22,19 +22,13 @@
bencode,
btree_index,
errors,
- sack,
+ pack_collection,
tests,
)
from bzrlib.transport import memory
-class TestSack(tests.TestCaseWithMemoryTransport):
-
- def test_sack(self):
- pass
-
-
def assert_index_content(test, a_dict, index):
as_dict = {}
for info in index.iter_all_entries():
@@ -66,16 +60,16 @@
self.assertEqual(index_content, index_dict)
def test_tail_info(self):
- self.assertAsBytes({}, sack.TrailingIndexBuilder(0))
- self.assertAsBytes({}, sack.TrailingIndexBuilder(12345))
- self.assertAsBytes({}, sack.TrailingIndexBuilder(2**48-1))
- self.assertAsBytes({}, sack.TrailingIndexBuilder(2**64-1))
- ti = sack.TrailingIndexBuilder(2**64-1)
+ self.assertAsBytes({}, pack_collection.TrailingIndexBuilder(0))
+ self.assertAsBytes({}, pack_collection.TrailingIndexBuilder(12345))
+ self.assertAsBytes({}, pack_collection.TrailingIndexBuilder(2**48-1))
+ self.assertAsBytes({}, pack_collection.TrailingIndexBuilder(2**64-1))
+ ti = pack_collection.TrailingIndexBuilder(2**64-1)
ti.version = 3
self.assertAsBytes({}, ti)
def test_with_content(self):
- builder = sack.TrailingIndexBuilder(start_offset=500)
+ builder = pack_collection.TrailingIndexBuilder(start_offset=500)
builder.add_section_info('revisions', 0, 100)
builder.add_section_info('inventories', 100, 50)
builder.add_section_info('texts', 150, 350)
@@ -89,7 +83,7 @@
def assertTailBytes(self, start_offset, version, bytes):
self.assertEqual((start_offset, version),
- sack.TrailingIndex.parse_tail_bytes(bytes))
+ pack_collection.TrailingIndex.parse_tail_bytes(bytes))
def test_parse_tail_bytes(self):
self.assertTailBytes(12345, 1,
@@ -102,12 +96,12 @@
def test_from_transport(self):
# We should be able to bootstrap all info starting with just a path on
# disk
- builder = sack.TrailingIndexBuilder(start_offset=500)
+ builder = pack_collection.TrailingIndexBuilder(start_offset=500)
builder.add_section_info('texts', 150, 350)
content = builder.finish()
t = memory.MemoryTransport('')
- t.put_bytes('test.sack', ' '*500 + content)
- ti = sack.TrailingIndex.from_transport(t, 'test.sack')
+ t.put_bytes('test.pack', ' '*500 + content)
+ ti = pack_collection.TrailingIndex.from_transport(t, 'test.pack')
# We skip the 16-byte header at the beginning, and the 12-byte tail
self.assertEqual({'texts': (150, 350)}, ti._sections)
@@ -117,14 +111,14 @@
index_builder.add_node(('key2',), 'value2')
text_idx_content = index_builder.finish().read()
trail_start = len(text_idx_content)
- trailing_builder = sack.TrailingIndexBuilder(
- start_offset=trail_start)
+ trailing_builder = pack_collection.TrailingIndexBuilder(
+ start_offset=trail_start)
trailing_builder.add_section_info('texts', 0, trail_start)
trailing_content = trailing_builder.finish()
content = text_idx_content + trailing_content
t = memory.MemoryTransport('')
- t.put_bytes('test.sack', content)
- ti = sack.TrailingIndex.from_transport(t, 'test.sack')
+ t.put_bytes('test.pack', content)
+ ti = pack_collection.TrailingIndex.from_transport(t, 'test.pack')
self.assertEqual({'texts': (0, trail_start)},
ti._sections)
text_index = ti.get_named_index('texts', btree_index.BTreeGraphIndex)
More information about the bazaar-commits
mailing list