Rev 2625: InMemoryGraphIndex.add_nodes was inconsistent with other metods for non-node-reference indices. in http://people.ubuntu.com/~robertc/baz2.0/index
Robert Collins
robertc at robertcollins.net
Wed Jul 18 05:46:27 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/index
------------------------------------------------------------
revno: 2625
revision-id: robertc at robertcollins.net-20070718044624-kb7pmne2pd96ekum
parent: pqm at pqm.ubuntu.com-20070717110203-zzmtp28nunhsoz12
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Wed 2007-07-18 14:46:24 +1000
message:
InMemoryGraphIndex.add_nodes was inconsistent with other metods for non-node-reference indices.
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-15 15:40:37 +0000
+++ b/bzrlib/index.py 2007-07-18 04:46:24 +0000
@@ -365,8 +365,12 @@
:param nodes: An iterable of (key, node_refs, value) entries to add.
"""
- for (key, value, node_refs) in nodes:
- self.add_node(key, value, node_refs)
+ if self.reference_lists:
+ for (key, value, node_refs) in nodes:
+ self.add_node(key, value, node_refs)
+ else:
+ for (key, value) in nodes:
+ self.add_node(key, value)
def iter_all_entries(self):
"""Iterate over all keys within the index
=== modified file 'bzrlib/tests/test_index.py'
--- a/bzrlib/tests/test_index.py 2007-07-15 15:40:37 +0000
+++ b/bzrlib/tests/test_index.py 2007-07-18 04:46:24 +0000
@@ -471,6 +471,16 @@
result.add_nodes(nodes)
return result
+ def test_add_nodes_no_refs(self):
+ index = self.make_index(0)
+ index.add_nodes([('name', 'data')])
+ index.add_nodes([('name2', ''), ('name3', '')])
+ self.assertEqual(set([
+ ('name', 'data'),
+ ('name2', ''),
+ ('name3', ''),
+ ]), set(index.iter_all_entries()))
+
def test_add_nodes(self):
index = self.make_index(1)
index.add_nodes([('name', 'data', ([],))])
@@ -486,7 +496,7 @@
self.assertEqual([], list(index.iter_all_entries()))
def test_iter_all_entries_simple(self):
- index = self.make_index(nodes=[('name', 'data', ())])
+ index = self.make_index(nodes=[('name', 'data')])
self.assertEqual([('name', 'data')],
list(index.iter_all_entries()))
@@ -528,7 +538,7 @@
index.validate()
def test_validate_no_refs_content(self):
- index = self.make_index(nodes=[('key', 'value', ())])
+ index = self.make_index(nodes=[('key', 'value')])
index.validate()
More information about the bazaar-commits
mailing list