~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2005-12-26 06:29:28 UTC
  • mto: This revision was merged to the branch mainline in revision 1533.
  • Revision ID: aaron.bentley@utoronto.ca-20051226062928-09c4e07bcdfce3af
Fixed hashcache

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
        self.branch = branch
194
194
        self.basedir = realpath(basedir)
195
195
 
196
 
        self._set_inventory(self.read_working_inventory())
197
 
 
198
196
        # update the whole cache up front and write to disk if anything changed;
199
197
        # in the future we might want to do this more selectively
200
198
        # two possible ways offer themselves : in self._unlock, write the cache
209
207
            mutter("write hc")
210
208
            hc.write()
211
209
 
 
210
        self._set_inventory(self.read_working_inventory())
 
211
 
212
212
    def _set_inventory(self, inv):
213
213
        self._inventory = inv
214
214
        self.path2id = self._inventory.path2id
314
314
    def get_file_size(self, file_id):
315
315
        return os.path.getsize(self.id2abspath(file_id))
316
316
 
 
317
    @needs_read_lock
317
318
    def get_file_sha1(self, file_id):
318
319
        path = self._inventory.id2path(file_id)
319
320
        return self._hashcache.get_sha1(path)
909
910
        between multiple working trees, i.e. via shared storage, then we 
910
911
        would probably want to lock both the local tree, and the branch.
911
912
        """
 
913
        if self._hashcache.needs_write:
 
914
            self._hashcache.write()
912
915
        return self.branch.unlock()
913
916
 
914
917
    @needs_write_lock