Rev 2647: Test using a KnitGraphIndex for storage. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Sat Jul 14 08:49:15 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 2647
revision-id: robertc at robertcollins.net-20070714074913-j4yjfy6ztueqcwhx
parent: robertc at robertcollins.net-20070714074258-eagpvwqma0kjm8ys
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sat 2007-07-14 17:49:13 +1000
message:
  Test using a KnitGraphIndex for storage.
modified:
  bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2007-07-14 07:02:10 +0000
+++ b/bzrlib/tests/test_knit.py	2007-07-14 07:49:13 +0000
@@ -929,6 +929,24 @@
         k.clear_cache()
         self.assertEqualDiff(''.join(k.get_lines('text-1a')), TEXT_1A)
 
+    def test_add_delta_knit_graph_index(self):
+        """Does adding work with a KnitGraphIndex."""
+        index = InMemoryGraphIndex(2)
+        knit_index = KnitGraphIndex(index, add_callback=index.add_nodes,
+            deltas=True)
+        k = KnitVersionedFile('test', get_transport('.'),
+            delta=True, create=True, index=knit_index)
+        self.add_stock_one_and_one_a(k)
+        k.clear_cache()
+        self.assertEqualDiff(''.join(k.get_lines('text-1a')), TEXT_1A)
+        # check the index had the right data added.
+        self.assertEqual(set([
+            ('text-1', ((), ()), ' 0 127'),
+            ('text-1a', (('text-1',), ('text-1',)), ' 127 140'),
+            ]), set(index.iter_all_entries()))
+        # we should not have a .kndx file
+        self.assertFalse(get_transport('.').has('test.kndx'))
+
     def test_annotate(self):
         """Annotations"""
         k = KnitVersionedFile('knit', get_transport('.'), factory=KnitAnnotateFactory(),




More information about the bazaar-commits mailing list