Rev 3851: Actually write a correctly failing test for the knits with deltas and bad order behavior. in http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/revision_stream

John Arbash Meinel john at arbash-meinel.com
Wed Nov 26 03:35:29 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/revision_stream

------------------------------------------------------------
revno: 3851
revision-id: john at arbash-meinel.com-20081126033509-eie1c2ge59y5fro4
parent: john at arbash-meinel.com-20081125203957-6ru90u67o1x07prb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: revision_stream
timestamp: Tue 2008-11-25 21:35:09 -0600
message:
  Actually write a correctly failing test for the knits with deltas and bad order behavior.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2008-11-25 20:39:57 +0000
+++ b/bzrlib/tests/test_fetch.py	2008-11-26 03:35:09 +0000
@@ -441,16 +441,29 @@
         tree.add('file', 'file-id')
         tree.commit('one', rev_id='rev-one')
         # Hack the KVF for revisions so that it "accidentally" allows a delta
-        tree.branch.repository.revisions._max_delta_chain = 200
+        source = tree.branch.repository
+        source.revisions._max_delta_chain = 200
         tree.commit('two', rev_id='rev-two')
-        source = tree.branch.repository
-        # Ensure that we stored a delta
         source.lock_read()
         self.addCleanup(source.unlock)
+
+        orig_grs = source.revisions.get_record_stream
+        def rev_ordered_get_record_stream(keys, ordering,
+                                          include_delta_closure):
+            """Get the record stream in reverse sorted order for 'unordered'"""
+            if ordering == 'topological':
+                for record in orig_grs(keys, ordering, include_delta_closure):
+                    yield record
+            self.assertEqual('unordered', ordering)
+            for key in sorted(keys, reverse=True):
+                yield orig_grs([key], ordering, include_delta_closure).next()
+        source.revisions.get_record_stream = rev_ordered_get_record_stream
+
+        # Ensure that we stored a delta
         record = source.revisions.get_record_stream([('rev-two',)],
             'unordered', False).next()
         self.assertEqual('knit-delta-gz', record.storage_kind)
-        target.fetch(tree.branch.repository, revision_id='rev-two')
+        target.fetch(source, revision_id='rev-two')
         # The record should get expanded back to a fulltext
         target.lock_read()
         self.addCleanup(target.unlock)



More information about the bazaar-commits mailing list