~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-04 14:04:52 UTC
  • mto: This revision was merged to the branch mainline in revision 6052.
  • Revision ID: jelmer@samba.org-20110804140452-orzrucd9edpuig86
Add PreviewTree.get_file_verifier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2258
2258
        else:
2259
2259
            return None
2260
2260
 
 
2261
    def get_file_verifier(self, file_id, path=None, stat_value=None):
 
2262
        trans_id = self._transform.trans_id_file_id(file_id)
 
2263
        kind = self._transform._new_contents.get(trans_id)
 
2264
        if kind is None:
 
2265
            return self._transform._tree.get_file_verifier(file_id)
 
2266
        if kind == 'file':
 
2267
            fileobj = self.get_file(file_id)
 
2268
            try:
 
2269
                return ("sha1", sha_file(fileobj))
 
2270
            finally:
 
2271
                fileobj.close()
 
2272
 
2261
2273
    def get_file_sha1(self, file_id, path=None, stat_value=None):
2262
2274
        trans_id = self._transform.trans_id_file_id(file_id)
2263
2275
        kind = self._transform._new_contents.get(trans_id)