At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/pack_retry_153786
------------------------------------------------------------
revno: 3796
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: pack_retry_153786
timestamp: Thu 2008-10-23 15:53:50 -0500
message:
CombinedGraphIndex.validate() will now reload.
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py 2008-10-23 20:50:58 +0000
+++ b/bzrlib/index.py 2008-10-23 20:53:50 +0000
@@ -1274,8 +1274,13 @@
def validate(self):
"""Validate that everything in the index can be accessed."""
- for index in self._indices:
- index.validate()
+ while True:
+ try:
+ for index in self._indices:
+ index.validate()
+ return
+ except errors.NoSuchFile:
+ self._reload_or_raise()
class InMemoryGraphIndex(GraphIndexBuilder):
=== modified file 'bzrlib/tests/test_index.py'
--- a/bzrlib/tests/test_index.py 2008-10-23 20:50:58 +0000
+++ b/bzrlib/tests/test_index.py 2008-10-23 20:53:50 +0000
@@ -1214,6 +1214,25 @@
self.assertListRaises(errors.NoSuchFile, index.iter_entries_prefix,
[('1',)])
+ def test_validate_reloads(self):
+ index, reload_counter = self.make_combined_index_with_missing()
+ index.validate()
+ self.assertEqual([1, 1, 0], reload_counter)
+
+ def test_validate_reloads_midway(self):
+ index, reload_counter = self.make_combined_index_with_missing(['2'])
+ index.validate()
+
+ def test_validate_no_reload(self):
+ index, reload_counter = self.make_combined_index_with_missing()
+ index._reload_func = None
+ self.assertRaises(errors.NoSuchFile, index.validate)
+
+ def test_validate_reloads_and_fails(self):
+ index, reload_counter = self.make_combined_index_with_missing(
+ ['1', '2', '3'])
+ self.assertRaises(errors.NoSuchFile, index.validate)
+
class TestInMemoryGraphIndex(TestCaseWithMemoryTransport):
--
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits