Rev 4513: Track down why the annotate retry code was failing. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
John Arbash Meinel
john at arbash-meinel.com
Mon Jul 6 17:48:30 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
------------------------------------------------------------
revno: 4513
revision-id: john at arbash-meinel.com-20090706164802-xkggaivxyykbgira
parent: john at arbash-meinel.com-20090702214305-sss4k9xd5shtu99z
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Mon 2009-07-06 11:48:02 -0500
message:
Track down why the annotate retry code was failing.
It was just that we were re-using a variable name, which was causing us to
retry and annotate the wrong text.
-------------- next part --------------
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2009-06-24 20:44:46 +0000
+++ b/bzrlib/knit.py 2009-07-06 16:48:02 +0000
@@ -3426,11 +3426,11 @@
while True:
try:
records = self._get_build_graph(key)
- for idx, (key, text, num_lines) in enumerate(
+ for idx, (sub_key, text, num_lines) in enumerate(
self._extract_texts(records)):
if pb is not None:
pb.update('annotating', idx, len(records))
- yield key, text, num_lines
+ yield sub_key, text, num_lines
return
except errors.RetryWithNewPacks, e:
self._vf._access.reload_or_raise(e)
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py 2009-06-23 19:38:27 +0000
+++ b/bzrlib/tests/test_knit.py 2009-07-06 16:48:02 +0000
@@ -366,16 +366,25 @@
:return: (versioned_file, reload_counter)
versioned_file a KnitVersionedFiles using the packs for access
"""
- tree = self.make_branch_and_memory_tree('tree')
- tree.lock_write()
- self.addCleanup(tree.unlock)
- tree.add([''], ['root-id'])
- tree.commit('one', rev_id='rev-1')
- tree.commit('two', rev_id='rev-2')
- tree.commit('three', rev_id='rev-3')
+ builder = self.make_branch_builder('.')
+ builder.start_series()
+ builder.build_snapshot('rev-1', None, [
+ ('add', ('', 'root-id', 'directory', None)),
+ ('add', ('file', 'file-id', 'file', 'content\nrev 1\n')),
+ ])
+ builder.build_snapshot('rev-2', ['rev-1'], [
+ ('modify', ('file-id', 'content\nrev 2\n')),
+ ])
+ builder.build_snapshot('rev-3', ['rev-2'], [
+ ('modify', ('file-id', 'content\nrev 3\n')),
+ ])
+ builder.finish_series()
+ b = builder.get_branch()
+ b.lock_write()
+ self.addCleanup(b.unlock)
# Pack these three revisions into another pack file, but don't remove
# the originals
- repo = tree.branch.repository
+ repo = b.repository
collection = repo._pack_collection
collection.ensure_loaded()
orig_packs = collection.packs
@@ -384,7 +393,7 @@
# forget about the new pack
collection.reset()
repo.refresh_data()
- vf = tree.branch.repository.revisions
+ vf = repo.revisions
# Set up a reload() function that switches to using the new pack file
new_index = new_pack.revision_index
access_tuple = new_pack.access_tuple()
More information about the bazaar-commits
mailing list