~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-08 17:35:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1937.
  • Revision ID: john@arbash-meinel.com-20060808173542-c82ed5ec155efe65
Small tweak to hashcache to make it write out faster

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",