Rev 2335: Lazily read working inventory in workingtree.py, in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/make_locking_cheaper
John Arbash Meinel
john at arbash-meinel.com
Wed Mar 21 17:51:52 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/make_locking_cheaper
------------------------------------------------------------
revno: 2335
revision-id: john at arbash-meinel.com-20070321175142-052tm470fx9s0obl
parent: pqm at pqm.ubuntu.com-20070310232535-dd964b3ad4a93236
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: make_locking_cheaper
timestamp: Wed 2007-03-21 12:51:42 -0500
message:
Lazily read working inventory in workingtree.py,
this exposes code paths that are not locking the tree before
processing, because they are directly accessing tree._inventory somehow
(one case is Tree.path2id())
modified:
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2007-03-07 03:09:14 +0000
+++ b/bzrlib/tree.py 2007-03-21 17:51:42 +0000
@@ -266,6 +266,7 @@
"file is actually %s" % fp['sha1'],
"store is probably damaged/corrupt"])
+ @needs_read_lock
def path2id(self, path):
"""Return the id for path in this tree."""
return self._inventory.path2id(path)
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-03-10 20:35:58 +0000
+++ b/bzrlib/workingtree.py 2007-03-21 17:51:42 +0000
@@ -277,8 +277,10 @@
hc.write()
if _inventory is None:
+ # This will be acquired on lock_read() or lock_write()
self._inventory_is_modified = False
- self.read_working_inventory()
+ self._inventory = None
+ self._inventory_fp = None
else:
# the caller of __init__ has provided an inventory,
# we assume they know what they are doing - as its only
More information about the bazaar-commits
mailing list