Rev 5094: We need to implement _diff_memos_from_disk. 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 22:54:54 GMT 2010
At http://bzr.arbash-meinel.com/branches/bzr/lp/2.2.0b2-contained-pack
------------------------------------------------------------
revno: 5094
revision-id: john at arbash-meinel.com-20100305225419-073zq23gzeq3e648
parent: john at arbash-meinel.com-20100305225015-d70rj7czf6zgagky
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.2.0b2-contained-pack
timestamp: Fri 2010-03-05 16:54:19 -0600
message:
We need to implement _diff_memos_from_disk.
-------------- next part --------------
=== modified file 'bzrlib/pack_collection.py'
--- a/bzrlib/pack_collection.py 2010-03-05 22:50:15 +0000
+++ b/bzrlib/pack_collection.py 2010-03-05 22:54:19 +0000
@@ -290,6 +290,7 @@
"""Save the current in-memory content to disk."""
# TODO: Ensure disk locking
builder = self._index_builder_class(reference_lists=0, key_elements=1)
+ # TODO: _diff_memos_from_disk
for name, value in self._memos.iteritems():
builder.add_node((name,), value)
self.transport.put_file(self.filename, builder.finish(),
=== modified file 'bzrlib/tests/test_pack_collection.py'
--- a/bzrlib/tests/test_pack_collection.py 2010-03-05 22:50:15 +0000
+++ b/bzrlib/tests/test_pack_collection.py 2010-03-05 22:54:19 +0000
@@ -203,3 +203,25 @@
tracker.save()
btree = tracker._index_class(t, 'meta', size=None)
self.assertEqual(1, btree.key_count())
+
+ def test_add_with_concurrent_add(self):
+ t = self.get_transport()
+ tracker = TrivialMemoTracker(t, 'meta')
+ tracker.add_memo('name', 'content')
+ tracker.save()
+ tracker2 = TrivialMemoTracker(t, 'meta')
+ tracker2.add_memo('name2', 'content2')
+ tracker.add_memo('name3', 'content3')
+ tracker2.save()
+ tracker.save()
+ # When we save, tracker should notice that there was a new entry, and
+ # add it to the in-memory data.
+ self.assertEqual({'name': 'content',
+ 'name2': 'content2',
+ 'name3': 'content3',
+ }, tracker._memos)
+ self.assertEqual([], sorted(tracker._added_info))
+ self.assertEqual([], sorted(tracker._removed_info))
+ # And the on-disk record should also have all 3
+ btree = tracker._index_class(t, 'meta', size=None)
+ self.assertEqual(3, btree.key_count())
More information about the bazaar-commits
mailing list