Rev 2771: Fix test_fetch_missing_text_other_location_fails for pack repositories. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Sun Sep 23 10:45:29 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 2771
revision-id: robertc at robertcollins.net-20070923094510-8qf2wc92nktb0prq
parent: robertc at robertcollins.net-20070921062446-thh851c7u8d1o6xn
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sun 2007-09-23 19:45:10 +1000
message:
Fix test_fetch_missing_text_other_location_fails for pack repositories.
modified:
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2007-09-12 23:40:07 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2007-09-23 09:45:10 +0000
@@ -298,7 +298,10 @@
revision_index.key_count(),
time.time() - start_time)
# select inventory keys
- inv_keys = revision_keys # currently the same keyspace
+ inv_keys = revision_keys # currently the same keyspace, and note that
+ # querying for keys here could introduce a bug where an inventory item
+ # is missed, so do not change it to query separately without cross
+ # checking like the text key check below.
inv_nodes = self._index_contents(inventory_index_map, inv_keys)
# copy inventory keys and adjust values
# XXX: Should be a helper function to allow different inv representation
@@ -313,6 +316,7 @@
text_filter.extend(
[(fileid, file_revid) for file_revid in file_revids])
else:
+ # eat the iterator to cause it to execute.
list(inv_lines)
text_filter = None
if 'fetch' in debug.debug_flags:
@@ -322,6 +326,17 @@
time.time() - start_time)
# select text keys
text_nodes = self._index_contents(text_index_map, text_filter)
+ # We could return the keys copied as part of the return value from
+ # _copy_nodes_graph but this doesn't work all that well with the need
+ # to get line output too, so we check separately, and as we're going to
+ # buffer everything anyway, we check beforehand, which saves reading
+ # knit data over the wire when we know there are mising records.
+ text_nodes = set(text_nodes)
+ missing_text_keys = set(text_filter) - text_nodes
+ if missing_text_keys:
+ # TODO: raise a specific error that can handle many missing keys.
+ a_missing_key = missing_text_keys.pop()
+ raise errors.RevisionNotPresent(a_missing_key[1], a_missing_key[0])
# copy text keys and adjust values
list(self._copy_nodes_graph(text_nodes, text_index_map, writer,
text_index))
=== modified file 'bzrlib/tests/interrepository_implementations/test_interrepository.py'
--- a/bzrlib/tests/interrepository_implementations/test_interrepository.py 2007-09-20 22:58:47 +0000
+++ b/bzrlib/tests/interrepository_implementations/test_interrepository.py 2007-09-23 09:45:10 +0000
@@ -178,7 +178,8 @@
source = source_tree.branch.repository
target = self.make_to_repository('target')
- # start by adding a file so the data for hte file exists.
+ # start by adding a file so the data knit for the file exists in
+ # repositories that have specific files for each fileid.
self.build_tree(['source/id'])
source_tree.add(['id'], ['id'])
source_tree.commit('a', rev_id='a')
More information about the bazaar-commits
mailing list