~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# TODO: Perhaps return more details on the file to avoid statting it
24
24
# again: nonexistent, file type, size, etc
25
25
 
 
26
# TODO: Perhaps use a Python pickle instead of a text file; might be faster.
 
27
 
26
28
 
27
29
 
28
30
CACHE_HEADER = "### bzr hashcache v5\n"
31
33
 
32
34
from bzrlib.osutils import sha_file
33
35
from bzrlib.trace import mutter, warning
 
36
from bzrlib.atomicfile import AtomicFile
 
37
 
34
38
 
35
39
 
36
40
 
135
139
                del self._cache[path]
136
140
 
137
141
 
138
 
 
139
142
    def get_sha1(self, path):
140
143
        """Return the sha1 of a file.
141
144
        """
185
188
 
186
189
    def write(self):
187
190
        """Write contents of cache to file."""
188
 
        from atomicfile import AtomicFile
189
 
 
190
191
        outf = AtomicFile(self.cache_file_name(), 'wb')
191
192
        try:
192
193
            print >>outf, CACHE_HEADER,