~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/hashcache.py

  • Committer: Aaron Bentley
  • Date: 2007-02-06 14:52:16 UTC
  • mfrom: (2266 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2268.
  • Revision ID: abentley@panoramicfeedback.com-20070206145216-fcpi8o3ufvuzwbp9
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
    def __init__(self, root, cache_file_name, mode=None):
84
84
        """Create a hash cache in base dir, and set the file mode to mode."""
85
85
        self.root = safe_unicode(root)
86
 
        self.root_utf8 = self.root.encode('utf8') # where is the filesystem encoding ?
87
86
        self.hit_count = 0
88
87
        self.miss_count = 0
89
88
        self.stat_count = 0
132
131
    def get_sha1(self, path, stat_value=None):
133
132
        """Return the sha1 of a file.
134
133
        """
135
 
        if path.__class__ is str:
136
 
            abspath = pathjoin(self.root_utf8, path)
137
 
        else:
138
 
            abspath = pathjoin(self.root, path)
 
134
        abspath = pathjoin(self.root, path)
139
135
        self.stat_count += 1
140
136
        file_fp = self._fingerprint(abspath, stat_value)
141
137
        
210
206
            outf.write(CACHE_HEADER)
211
207
 
212
208
            for path, c  in self._cache.iteritems():
 
209
                assert '//' not in path, path
213
210
                line_info = [path.encode('utf-8'), '// ', c[0], ' ']
214
211
                line_info.append(' '.join([str(fld) for fld in c[1]]))
215
212
                line_info.append('\n')