Rev 4516: Add a test that shows when parent texts, etc, are present, we don't request again. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
John Arbash Meinel
john at arbash-meinel.com
Mon Jul 6 20:05:57 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
------------------------------------------------------------
revno: 4516
revision-id: john at arbash-meinel.com-20090706190526-4rn5l49rigy4wia2
parent: john at arbash-meinel.com-20090706185924-qlhn1j607117lgdj
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Mon 2009-07-06 14:05:26 -0500
message:
Add a test that shows when parent texts, etc, are present, we don't request again.
-------------- next part --------------
=== modified file 'bzrlib/tests/test__annotator.py'
--- a/bzrlib/tests/test__annotator.py 2009-07-06 18:59:24 +0000
+++ b/bzrlib/tests/test__annotator.py 2009-07-06 19:05:26 +0000
@@ -259,6 +259,35 @@
], sorted(keys))
self.assertEqual([spec_key], sorted(ann_keys))
+ def test_needed_keys_with_parent_texts(self):
+ self.make_many_way_common_merge_text()
+ # If 'D' and 'E' are already annotated, we don't need to extract all
+ # the texts
+ # D | 'simple|new content|'
+ # | |
+ # | E 'simple|new content|'
+ # | /
+ # F-' 'simple|new content|'
+ self.ann._parent_map[self.fd_key] = (self.fb_key, self.fc_key)
+ self.ann._text_cache[self.fd_key] = ['simple\n', 'new content\n']
+ self.ann._annotations_cache[self.fd_key] = [
+ (self.fa_key,),
+ (self.fb_key, self.fc_key),
+ ]
+ self.ann._parent_map[self.fe_key] = (self.fa_key,)
+ self.ann._text_cache[self.fe_key] = ['simple\n', 'new content\n']
+ self.ann._annotations_cache[self.fe_key] = [
+ (self.fa_key,),
+ (self.fe_key,),
+ ]
+ keys, ann_keys = self.ann._get_needed_keys(self.ff_key)
+ self.assertEqual([self.ff_key], sorted(keys))
+ self.assertEqual({self.fd_key: 1,
+ self.fe_key: 1,
+ self.ff_key: 1,
+ }, self.ann._num_needed_children)
+ self.assertEqual([], sorted(ann_keys))
+
def test_record_annotation_removes_texts(self):
self.make_many_way_common_merge_text()
# Populate the caches
More information about the bazaar-commits
mailing list