39
class WorkingTree3(InventoryWorkingTree):
44
class PreDirStateWorkingTree(InventoryWorkingTree):
46
def __init__(self, basedir='.', *args, **kwargs):
47
super(PreDirStateWorkingTree, self).__init__(basedir, *args, **kwargs)
48
# update the whole cache up front and write to disk if anything changed;
49
# in the future we might want to do this more selectively
50
# two possible ways offer themselves : in self._unlock, write the cache
51
# if needed, or, when the cache sees a change, append it to the hash
52
# cache file, and have the parser take the most recent entry for a
54
wt_trans = self.bzrdir.get_workingtree_transport(None)
55
cache_filename = wt_trans.local_abspath('stat-cache')
56
self._hashcache = hashcache.HashCache(basedir, cache_filename,
57
self.bzrdir._get_file_mode(),
58
self._content_filter_stack_provider())
61
# is this scan needed ? it makes things kinda slow.
65
trace.mutter("write hc")
68
def _write_hashcache_if_dirty(self):
69
"""Write out the hashcache if it is dirty."""
70
if self._hashcache.needs_write:
72
self._hashcache.write()
74
if e.errno not in (errno.EPERM, errno.EACCES):
76
# TODO: jam 20061219 Should this be a warning? A single line
77
# warning might be sufficient to let the user know what
79
trace.mutter('Could not write hashcache for %s\nError: %s',
80
self._hashcache.cache_file_name(), e)
83
def get_file_sha1(self, file_id, path=None, stat_value=None):
85
path = self._inventory.id2path(file_id)
86
return self._hashcache.get_sha1(path, stat_value)
89
class WorkingTree3(PreDirStateWorkingTree):
40
90
"""This is the Format 3 working tree.
42
92
This differs from the base WorkingTree by: