~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-22 22:51:47 UTC
  • mfrom: (2334.1.6 make_locking_cheaper)
  • Revision ID: pqm@pqm.ubuntu.com-20070322225147-c274f2efe3564edc
(John Arbash Meinel) Change WorkingTree to not read the inventory until we have a lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
            hc.write()
278
278
 
279
279
        if _inventory is None:
 
280
            # This will be acquired on lock_read() or lock_write()
280
281
            self._inventory_is_modified = False
281
 
            self.read_working_inventory()
 
282
            self._inventory = None
282
283
        else:
283
284
            # the caller of __init__ has provided an inventory,
284
285
            # we assume they know what they are doing - as its only
2296
2297
     - uses the branch last-revision.
2297
2298
    """
2298
2299
 
 
2300
    def __init__(self, *args, **kwargs):
 
2301
        super(WorkingTree2, self).__init__(*args, **kwargs)
 
2302
        # WorkingTree2 has more of a constraint that self._inventory must
 
2303
        # exist. Because this is an older format, we don't mind the overhead
 
2304
        # caused by the extra computation here.
 
2305
 
 
2306
        # Newer WorkingTree's should only have self._inventory set when they
 
2307
        # have a read lock.
 
2308
        if self._inventory is None:
 
2309
            self.read_working_inventory()
 
2310
 
2299
2311
    def lock_tree_write(self):
2300
2312
        """See WorkingTree.lock_tree_write().
2301
2313