Rev 3790: add the failing acceptance test for the first portion. in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/pack_retry_153786

John Arbash Meinel john at arbash-meinel.com
Thu Oct 23 20:12:08 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/pack_retry_153786

------------------------------------------------------------
revno: 3790
revision-id: john at arbash-meinel.com-20081023191146-jiz88y5og2koaahs
parent: pqm at pqm.ubuntu.com-20081021231845-k119hl1icewguq50
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pack_retry_153786
timestamp: Thu 2008-10-23 14:11:46 -0500
message:
  add the failing acceptance test for the first portion.
  
  When going through 'get_parent_map', if the index is missing, we should have
  reloaded the index list without the calling code needing to know anything.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2008-09-25 22:25:09 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2008-10-23 19:11:46 +0000
@@ -395,6 +395,27 @@
         finally:
             r1.unlock()
 
+    def test_concurrent_pack_triggers_reload(self):
+        # create 2 packs, which we will then collapse
+        tree = self.make_branch_and_tree('tree')
+        rev1 = tree.commit('one')
+        rev2 = tree.commit('two')
+        r1 = tree.branch.repository
+        r2 = repository.Repository.open('tree')
+        r1.lock_write()
+        try:
+            r2.lock_read()
+            try:
+                # Now r2 has read the pack-names file, but will need to reload
+                # it after r1 has repacked
+                r1.pack()
+                self.assertEqual({rev2:(rev1,)},
+                                 r2.get_parent_map([rev2]))
+            finally:
+                r2.unlock()
+        finally:
+            r1.unlock()
+
     def test_lock_write_does_not_physically_lock(self):
         repo = self.make_repository('.', format=self.get_format())
         repo.lock_write()



More information about the bazaar-commits mailing list