/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-15 13:20:18 UTC
  • mfrom: (1924 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1926.
  • Revision ID: john@arbash-meinel.com-20060815132018-b753fd07689ac31a
[merge] bzr.dev 1924

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        """Write contents of cache to file."""
204
204
        outf = AtomicFile(self.cache_file_name(), 'wb', new_mode=self._mode)
205
205
        try:
206
 
            print >>outf, CACHE_HEADER,
 
206
            outf.write(CACHE_HEADER)
207
207
 
208
208
            for path, c  in self._cache.iteritems():
209
209
                assert '//' not in path, path
210
 
                outf.write(path.encode('utf-8'))
211
 
                outf.write('// ')
212
 
                print >>outf, c[0],     # hex sha1
213
 
                for fld in c[1]:
214
 
                    print >>outf, "%d" % fld,
215
 
                print >>outf
 
210
                line_info = [path.encode('utf-8'), '// ', c[0], ' ']
 
211
                line_info.append(' '.join([str(fld) for fld in c[1]]))
 
212
                line_info.append('\n')
 
213
                outf.write(''.join(line_info))
216
214
            outf.commit()
217
215
            self.needs_write = False
218
216
            ## mutter("write hash cache: %s hits=%d misses=%d stat=%d recent=%d updates=%d",
220
218
            ##        self.stat_count,
221
219
            ##        self.danger_count, self.update_count)
222
220
        finally:
223
 
            if not outf.closed:
224
 
                outf.abort()
 
221
            outf.close()
225
222
 
226
223
    def read(self):
227
224
        """Reinstate cache from file.