Rev 60: Test that deletes are not indexed on format 1 indices. in http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk
Robert Collins
robertc at robertcollins.net
Tue Dec 2 20:11:30 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk
------------------------------------------------------------
revno: 60
revision-id: robertc at robertcollins.net-20081202201128-i0atixnpghxntp4v
parent: robertc at robertcollins.net-20081202190844-y4bl3qymkndab5m0
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Wed 2008-12-03 07:11:28 +1100
message:
Test that deletes are not indexed on format 1 indices.
modified:
tests/test_index.py test_index.py-20080608055509-hnimeek7q8tctkqf-4
=== modified file 'tests/test_index.py'
--- a/tests/test_index.py 2008-08-27 08:37:30 +0000
+++ b/tests/test_index.py 2008-12-02 20:11:28 +0000
@@ -206,6 +206,30 @@
all_terms[term] = set(posting_list)
self.assertEqual(expected_terms, all_terms)
+ def test_deleted_path_not_indexed_format_1(self):
+ tree = self.make_branch_and_tree('')
+ rev_index = index.init_index(tree.branch)
+ tree.add(['README.txt'], ['an-id'], ['file'])
+ tree.put_file_bytes_non_atomic('an-id', "content.\n")
+ revid = tree.commit('add')
+ tree.remove(['README.txt'])
+ revid2 = tree.commit('delete')
+ rev_index.index_revisions(tree.branch, [revid, revid2])
+ self.assertEqual(set([(revid,), (revid2,)]),
+ set(rev_index.indexed_revisions()))
+ rev_index = index.open_index_url('')
+ all_terms = {}
+ for term, posting_list in rev_index.all_terms():
+ all_terms[term] = set(posting_list)
+ # A deleted path is indexed at the point of deletion, and format one
+ # does not support this, so must not have a posting list for it.
+ self.assertFalse(('an-id', revid2) in all_terms)
+ return
+ # To test for presence, we would look for:
+ self.assertSubset([('an-id', revid2)], all_terms)
+ self.assertEqual(set([('p', '', 'README.txt')]),
+ all_terms[('an-id', revid2)])
+
def test_knit_snapshots_not_indexed(self):
# knit snapshots are a contributing factor to getting too-many hits.
# instead only new lines should really be considered.
More information about the bazaar-commits
mailing list