Rev 2774: Remove singly-used call_in_write_group Repository helper method. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Sun Sep 23 21:46:44 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 2774
revision-id: robertc at robertcollins.net-20070923204634-qvl1z0wlcxom08h5
parent: robertc at robertcollins.net-20070923202913-23jnssq8sqdv208i
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Mon 2007-09-24 06:46:34 +1000
message:
  Remove singly-used call_in_write_group Repository helper method.
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-09-21 06:24:46 +0000
+++ b/bzrlib/repository.py	2007-09-23 20:46:34 +0000
@@ -878,27 +878,6 @@
         # so we can detect unlock/relock - the write group is now entered.
         self._write_group = self.get_transaction()
 
-    @needs_write_lock
-    def call_in_write_group(self, fn, *args, **kwargs):
-        """Call a callable within a write group.
-
-        On error the write group is aborted and on success it is commited.
-
-        This method may not be called if the repository is already in a 
-        write group.
-
-        This can be used for testing methods normally used within a larger 
-        write group.
-        """
-        self.start_write_group()
-        try:
-            result = fn(*args, **kwargs)
-        except:
-            self.abort_write_group()
-            raise
-        self.commit_write_group()
-        return result
-
     def _start_write_group(self):
         """Template method for per-repository write group startup.
         

=== modified file 'bzrlib/tests/blackbox/test_reconcile.py'
--- a/bzrlib/tests/blackbox/test_reconcile.py	2007-08-28 22:19:15 +0000
+++ b/bzrlib/tests/blackbox/test_reconcile.py	2007-09-23 20:46:34 +0000
@@ -54,7 +54,11 @@
         repo = t.branch.repository
         inv = Inventory(revision_id='missing')
         inv.root.revision='missing'
-        repo.call_in_write_group(repo.add_inventory, 'missing', inv, [])
+        repo.lock_write()
+        repo.start_write_group()
+        repo.add_inventory('missing', inv, [])
+        repo.commit_write_group()
+        repo.unlock()
         (out, err) = self.run_bzr('reconcile')
         self.assertEqualDiff(out, "Reconciling repository %s\n"
                                   "Backup Inventory created.\n"



More information about the bazaar-commits mailing list