Rev 2631: CombinedGraphIndex.iter_entries does not need to see all entries. in http://people.ubuntu.com/~robertc/baz2.0/index
Robert Collins
robertc at robertcollins.net
Sat Jul 14 15:58:01 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/index
------------------------------------------------------------
revno: 2631
revision-id: robertc at robertcollins.net-20070714145757-n37rf8ezk0avc1eh
parent: robertc at robertcollins.net-20070714072312-alys3q6a5211eegq
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Sun 2007-07-15 00:57:57 +1000
message:
CombinedGraphIndex.iter_entries does not need to see all entries.
modified:
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
bzrlib/tests/test_index.py test_index.py-20070712131115-lolkarso50vjr64s-2
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py 2007-07-14 07:23:12 +0000
+++ b/bzrlib/index.py 2007-07-14 14:57:57 +0000
@@ -320,8 +320,9 @@
efficient order for the index.
"""
keys = set(keys)
- for node in self.iter_all_entries():
- if node[0] in keys:
+ for index in self._indices:
+ for node in index.iter_entries(keys):
+ keys.remove(node[0])
yield node
def validate(self):
=== modified file 'bzrlib/tests/test_index.py'
--- a/bzrlib/tests/test_index.py 2007-07-14 07:23:12 +0000
+++ b/bzrlib/tests/test_index.py 2007-07-14 14:57:57 +0000
@@ -372,6 +372,13 @@
('2', (), '')],
list(index.iter_all_entries()))
+ def test_iter_entries_two_indices_dup_key(self):
+ index1 = self.make_index('name1', nodes=[('name', (), 'data')])
+ index2 = self.make_index('name2', nodes=[('name', (), 'data')])
+ index = CombinedGraphIndex([index1, index2])
+ self.assertEqual([('name', (), 'data')],
+ list(index.iter_entries(['name'])))
+
def test_iter_all_entries_two_indices_dup_key(self):
index1 = self.make_index('name1', nodes=[('name', (), 'data')])
index2 = self.make_index('name2', nodes=[('name', (), 'data')])
More information about the bazaar-commits
mailing list