Rev 77: Fix test for indexing of knit stored texts to use a format appropriate to that test. in http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
Robert Collins
robertc at robertcollins.net
Tue Nov 3 00:31:46 GMT 2009
At http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
------------------------------------------------------------
revno: 77
revision-id: robertc at robertcollins.net-20091103003145-b4ix0bsb8sq4aa1w
parent: robertc at robertcollins.net-20091103002209-790b877khe0b7ssa
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2009-11-03 11:31:45 +1100
message:
Fix test for indexing of knit stored texts to use a format appropriate to that test.
=== modified file 'NEWS'
--- a/NEWS 2009-11-03 00:22:09 +0000
+++ b/NEWS 2009-11-03 00:31:45 +0000
@@ -14,7 +14,7 @@
* Hits were returning overly large summaries due to behaviour tweaks in
bzrlib. (Robert Collins, #461957)
- * Selftest compatibility with bzr 2.0.0 (Robert Collins, #461957, #461952)
+ * Selftest compatibility with bzr 2.0.0 (Robert Collins, #461951, #461952)
* 'StaticTuple' is no longer shown in search suggestion descriptions.
(Robert Collins)
=== modified file 'tests/test_index.py'
--- a/tests/test_index.py 2009-03-10 23:10:42 +0000
+++ b/tests/test_index.py 2009-11-03 00:31:45 +0000
@@ -299,7 +299,26 @@
# aggregate size causing the third one to be a snapshot; it should not
# be indexed with content matching the lines carried across from the
# first or second commits.
- tree = self.make_branch_and_tree('')
+ # Need a knit-compression using format to test:
+ tree = self.make_branch_and_tree('', format="1.9")
+ rev_index, revid3 = self.make_indexes_deltas_fixture(tree)
+ tree.lock_read()
+ self.assertEqual('fulltext',
+ tree.branch.repository.texts._index.get_method(('an-id', revid3)))
+ tree.unlock()
+ self.assertIndexedDeltas(tree, rev_index, revid3)
+
+ def test_2a_indexes_deltas(self):
+ # With 2a formats we should be indexing deltas.
+ # Setup - All 2a commits are full text, so its pretty simple, we just
+ # reuse the setup for test_knit_snapshots_not_indexed but do not make
+ # any assertions about the storage of the texts.
+ tree = self.make_branch_and_tree('', format="2a")
+ rev_index, revid3 = self.make_indexes_deltas_fixture(tree)
+ self.assertIndexedDeltas(tree, rev_index, revid3)
+
+ def make_indexes_deltas_fixture(self, tree):
+ """Setup a tree with tree commits to be indexed."""
tree.add(['README.txt'], ['an-id'], ['file'])
tree.put_file_bytes_non_atomic('an-id',
"small\ncontent\n")
@@ -311,10 +330,10 @@
tree.put_file_bytes_non_atomic('an-id',
"other\nother\ncontent\nother\nother\nother\n")
revid3 = tree.commit('')
- tree.lock_read()
- self.assertEqual('fulltext',
- tree.branch.repository.texts._index.get_method(('an-id', revid3)))
- tree.unlock()
+ return rev_index, revid3
+
+ def assertIndexedDeltas(self, tree, rev_index, revid3):
+ """Assert that tree's text get indexed using deltas not full texts."""
rev_index.index_revisions(tree.branch, [revid3])
self.assertEqual(set([(revid3,)]), set(rev_index.indexed_revisions()))
rev_index = index.open_index_url('')
More information about the bazaar-commits
mailing list