~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

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"
32
34
 
33
35
from bzrlib.osutils import sha_file
34
36
from bzrlib.trace import mutter, warning
 
37
from bzrlib.atomicfile import AtomicFile
 
38
 
35
39
 
36
40
FP_MODE_COLUMN = 5
37
41
 
136
140
                del self._cache[path]
137
141
 
138
142
 
139
 
 
140
143
    def get_sha1(self, path):
141
144
        """Return the sha1 of a file.
142
145
        """
191
194
        
192
195
    def write(self):
193
196
        """Write contents of cache to file."""
194
 
        from atomicfile import AtomicFile
195
 
 
196
197
        outf = AtomicFile(self.cache_file_name(), 'wb')
197
198
        try:
198
199
            print >>outf, CACHE_HEADER,