Rev 2338: WT2 needs to have an _inventory without a lock. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/make_locking_cheaper

John Arbash Meinel john at arbash-meinel.com
Thu Mar 22 15:18:21 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/make_locking_cheaper

------------------------------------------------------------
revno: 2338
revision-id: john at arbash-meinel.com-20070322151814-fs1m2j0inf8nu7w0
parent: john at arbash-meinel.com-20070321212157-3hmll50umf1nz1z3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: make_locking_cheaper
timestamp: Thu 2007-03-22 10:18:14 -0500
message:
  WT2 needs to have an _inventory without a lock.
modified:
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-03-21 18:15:57 +0000
+++ b/bzrlib/workingtree.py	2007-03-22 15:18:14 +0000
@@ -2297,6 +2297,17 @@
      - uses the branch last-revision.
     """
 
+    def __init__(self, *args, **kwargs):
+        super(WorkingTree2, self).__init__(*args, **kwargs)
+        # WorkingTree2 has more of a constraint that self._inventory must
+        # exist. Because this is an older format, we don't mind the overhead
+        # caused by the extra computation here.
+
+        # Newer WorkingTree's should only have self._inventory set when they
+        # have a read lock.
+        if self._inventory is None:
+            self.read_working_inventory()
+
     def lock_tree_write(self):
         """See WorkingTree.lock_tree_write().
 



More information about the bazaar-commits mailing list