~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-05 16:51:01 UTC
  • mfrom: (5906.1.10 custom-verifier)
  • Revision ID: pqm@pqm.ubuntu.com-20110805165101-e89g9pgybm7db15a
(jelmer) Allow other kinds of file "verifiers" than SHA1. (Jelmer Vernooij)

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)