~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: 2008-09-25 06:17:07 UTC
  • mfrom: (3363.15.8 get_file_sha1)
  • Revision ID: pqm@pqm.ubuntu.com-20080925061707-6upxinw1nuuj0zl3
Implement get_files_sha1 and __contains__ on PreviewTree (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    has_symlinks,
42
42
    lexists,
43
43
    pathjoin,
 
44
    sha_file,
44
45
    splitpath,
45
46
    supports_executable,
46
47
)
1666
1667
            return None
1667
1668
 
1668
1669
    def get_file_sha1(self, file_id, path=None, stat_value=None):
1669
 
        return self._transform._tree.get_file_sha1(file_id)
 
1670
        trans_id = self._transform.trans_id_file_id(file_id)
 
1671
        kind = self._transform._new_contents.get(trans_id)
 
1672
        if kind is None:
 
1673
            return self._transform._tree.get_file_sha1(file_id)
 
1674
        if kind == 'file':
 
1675
            fileobj = self.get_file(file_id)
 
1676
            try:
 
1677
                return sha_file(fileobj)
 
1678
            finally:
 
1679
                fileobj.close()
1670
1680
 
1671
1681
    def is_executable(self, file_id, path=None):
1672
1682
        if file_id is None: