~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: Martin Pool
  • Date: 2007-04-04 06:17:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2397.
  • Revision ID: mbp@sourcefrog.net-20070404061731-tt2xrzllqhbodn83
Contents of TODO file moved into bug tracker

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
CACHE_HEADER = "### bzr hashcache v5\n"
31
31
 
32
32
import os, stat, time
 
33
import sha
33
34
 
34
 
from bzrlib.osutils import sha_file, sha_string, pathjoin, safe_unicode
 
35
from bzrlib.osutils import sha_file, pathjoin, safe_unicode
35
36
from bzrlib.trace import mutter, warning
36
37
from bzrlib.atomicfile import AtomicFile
37
38
from bzrlib.errors import BzrError
163
164
        if stat.S_ISREG(mode):
164
165
            digest = self._really_sha1_file(abspath)
165
166
        elif stat.S_ISLNK(mode):
166
 
            digest = sha_string(os.readlink(abspath))
 
167
            digest = sha.new(os.readlink(abspath)).hexdigest()
167
168
        else:
168
169
            raise BzrError("file %r: unknown file stat mode: %o"%(abspath,mode))
169
170
 
209
210
            outf.write(CACHE_HEADER)
210
211
 
211
212
            for path, c  in self._cache.iteritems():
 
213
                assert '//' not in path, path
212
214
                line_info = [path.encode('utf-8'), '// ', c[0], ' ']
213
215
                line_info.append(' '.join([str(fld) for fld in c[1]]))
214
216
                line_info.append('\n')