Rev 2621: Update tests with things that break when a repository requires write groups to be used. in http://people.ubuntu.com/~robertc/baz2.0/repo-write-group

Robert Collins robertc at robertcollins.net
Thu Jul 19 01:28:29 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repo-write-group

------------------------------------------------------------
revno: 2621
revision-id: robertc at robertcollins.net-20070719002827-t1pu9alpneh3k966
parent: robertc at robertcollins.net-20070718234410-sa56x9ui5la405jf
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repo-write-group
timestamp: Thu 2007-07-19 10:28:27 +1000
message:
  Update tests with things that break when a repository requires write groups to be used.
modified:
  bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'bzrlib/tests/repository_implementations/test_reconcile.py'
--- a/bzrlib/tests/repository_implementations/test_reconcile.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/repository_implementations/test_reconcile.py	2007-07-19 00:28:27 +0000
@@ -56,15 +56,21 @@
         t = get_transport(self.get_url())
         # an empty inventory with no revision for testing with.
         repo = self.make_repository('inventory_without_revision')
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id='missing')
         inv.root.revision = 'missing'
         repo.add_inventory('missing', inv, [])
+        repo.commit_write_group()
+        repo.unlock()
 
         # an empty inventory with no revision for testing with.
         # this is referenced by 'references_missing' to let us test
         # that all the cached data is correctly converted into ghost links
         # and the referenced inventory still cleaned.
         repo = self.make_repository('inventory_without_revision_and_ghost')
+        repo.lock_write()
+        repo.start_write_group()
         repo.add_inventory('missing', inv, [])
         inv = Inventory(revision_id='references_missing')
         inv.root.revision = 'references_missing'
@@ -77,10 +83,14 @@
                        revision_id='references_missing')
         rev.parent_ids = ['missing']
         repo.add_revision('references_missing', rev)
+        repo.commit_write_group()
+        repo.unlock()
 
         # a inventory with no parents and the revision has parents..
         # i.e. a ghost.
         repo = self.make_repository('inventory_one_ghost')
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id='ghost')
         inv.root.revision = 'ghost'
         sha1 = repo.add_inventory('ghost', inv, [])
@@ -92,12 +102,16 @@
                        revision_id='ghost')
         rev.parent_ids = ['the_ghost']
         repo.add_revision('ghost', rev)
+        repo.commit_write_group()
+        repo.unlock()
          
         # a inventory with a ghost that can be corrected now.
         t.copy_tree('inventory_one_ghost', 'inventory_ghost_present')
         bzrdir_url = self.get_url('inventory_ghost_present')
         bzrdir = bzrlib.bzrdir.BzrDir.open(bzrdir_url)
         repo = bzrdir.open_repository()
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id='the_ghost')
         inv.root.revision = 'the_ghost'
         sha1 = repo.add_inventory('the_ghost', inv, [])
@@ -109,6 +123,8 @@
                        revision_id='the_ghost')
         rev.parent_ids = []
         repo.add_revision('the_ghost', rev)
+        repo.commit_write_group()
+        repo.unlock()
 
     def checkEmptyReconcile(self, **kwargs):
         """Check a reconcile on an empty repository."""
@@ -281,6 +297,8 @@
 
         # now setup the wrong-first parent case
         repo = tree.branch.repository
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id='wrong-first-parent')
         inv.root.revision = 'wrong-first-parent'
         sha1 = repo.add_inventory('wrong-first-parent', inv, ['2', '1'])
@@ -292,9 +310,13 @@
                        revision_id='wrong-first-parent')
         rev.parent_ids = ['1', '2']
         repo.add_revision('wrong-first-parent', rev)
+        repo.commit_write_group()
+        repo.unlock()
 
         # now setup the wrong-secondary parent case
         repo = repo_secondary
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id='wrong-secondary-parent')
         inv.root.revision = 'wrong-secondary-parent'
         sha1 = repo.add_inventory('wrong-secondary-parent', inv, ['1', '3', '2'])
@@ -306,6 +328,8 @@
                        revision_id='wrong-secondary-parent')
         rev.parent_ids = ['1', '2', '3']
         repo.add_revision('wrong-secondary-parent', rev)
+        repo.commit_write_group()
+        repo.unlock()
 
     def test_reconcile_wrong_order(self):
         # a wrong order in primary parents is optionally correctable

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-06-22 05:05:22 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-07-19 00:28:27 +0000
@@ -262,7 +262,11 @@
         wt = self.make_branch_and_tree('source')
         wt.commit('A', allow_pointless=True, rev_id='A')
         repo = wt.branch.repository
+        repo.lock_write()
+        repo.start_write_group()
         repo.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
+        repo.commit_write_group()
+        repo.unlock()
         old_signature = repo.get_signature_text('A')
         try:
             old_format = bzrdir.BzrDirFormat.get_default_format()
@@ -598,6 +602,8 @@
         # a inventory with no parents and the revision has parents..
         # i.e. a ghost.
         repo = self.make_repository('inventory_with_unnecessary_ghost')
+        repo.lock_write()
+        repo.start_write_group()
         inv = Inventory(revision_id = 'ghost')
         inv.root.revision = 'ghost'
         sha1 = repo.add_inventory('ghost', inv, [])
@@ -624,6 +630,8 @@
         # check its setup usefully
         inv_weave = repo.get_inventory_weave()
         self.assertEqual(['ghost'], inv_weave.get_ancestry(['ghost']))
+        repo.commit_write_group()
+        repo.unlock()
 
     def test_corrupt_revision_access_asserts_if_reported_wrong(self):
         repo_url = self.get_url('inventory_with_unnecessary_ghost')



More information about the bazaar-commits mailing list