~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

Merge Aarons integration branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
        self.branch = branch
198
198
        self.basedir = realpath(basedir)
199
199
 
200
 
        self._set_inventory(self.read_working_inventory())
201
 
 
202
200
        # update the whole cache up front and write to disk if anything changed;
203
201
        # in the future we might want to do this more selectively
204
202
        # two possible ways offer themselves : in self._unlock, write the cache
213
211
            mutter("write hc")
214
212
            hc.write()
215
213
 
 
214
        self._set_inventory(self.read_working_inventory())
 
215
 
216
216
    def _set_inventory(self, inv):
217
217
        self._inventory = inv
218
218
        self.path2id = self._inventory.path2id
318
318
    def get_file_size(self, file_id):
319
319
        return os.path.getsize(self.id2abspath(file_id))
320
320
 
 
321
    @needs_read_lock
321
322
    def get_file_sha1(self, file_id):
322
323
        path = self._inventory.id2path(file_id)
323
324
        return self._hashcache.get_sha1(path)
913
914
        between multiple working trees, i.e. via shared storage, then we 
914
915
        would probably want to lock both the local tree, and the branch.
915
916
        """
 
917
        if self._hashcache.needs_write:
 
918
            self._hashcache.write()
916
919
        return self.branch.unlock()
917
920
 
918
921
    @needs_write_lock