~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-05 22:53:01 UTC
  • mfrom: (5834 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5844.
  • Revision ID: jelmer@samba.org-20110505225301-1az0eozrc08odlgw
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1898
1898
        path = self._tree_id_paths.get(trans_id)
1899
1899
        if path is None:
1900
1900
            return None
1901
 
        file_id = self._tree.path2id(path)
1902
 
        try:
1903
 
            return self._tree.kind(file_id)
1904
 
        except errors.NoSuchFile:
1905
 
            return None
 
1901
        kind = self._tree.path_content_summary(path)[0]
 
1902
        if kind == 'missing':
 
1903
            kind = None
 
1904
        return kind
1906
1905
 
1907
1906
    def _set_mode(self, trans_id, mode_id, typefunc):
1908
1907
        """Set the mode of new file contents.
1977
1976
            vf.fallback_versionedfiles.append(base_vf)
1978
1977
        return tree_revision
1979
1978
 
1980
 
    def _stat_limbo_file(self, file_id):
1981
 
        trans_id = self._transform.trans_id_file_id(file_id)
 
1979
    def _stat_limbo_file(self, file_id=None, trans_id=None):
 
1980
        if trans_id is None:
 
1981
            trans_id = self._transform.trans_id_file_id(file_id)
1982
1982
        name = self._transform._limbo_name(trans_id)
1983
1983
        return os.lstat(name)
1984
1984
 
2199
2199
 
2200
2200
    def get_file_size(self, file_id):
2201
2201
        """See Tree.get_file_size"""
 
2202
        trans_id = self._transform.trans_id_file_id(file_id)
 
2203
        kind = self._transform.final_kind(trans_id)
 
2204
        if kind != 'file':
 
2205
            return None
 
2206
        if trans_id in self._transform._new_contents:
 
2207
            return self._stat_limbo_file(trans_id=trans_id).st_size
2202
2208
        if self.kind(file_id) == 'file':
2203
2209
            return self._transform._tree.get_file_size(file_id)
2204
2210
        else:
2232
2238
            except errors.NoSuchId:
2233
2239
                return False
2234
2240
 
 
2241
    def has_filename(self, path):
 
2242
        trans_id = self._path2trans_id(path)
 
2243
        if trans_id in self._transform._new_contents:
 
2244
            return True
 
2245
        elif trans_id in self._transform._removed_contents:
 
2246
            return False
 
2247
        else:
 
2248
            return self._transform._tree.has_filename(path)
 
2249
 
2235
2250
    def path_content_summary(self, path):
2236
2251
        trans_id = self._path2trans_id(path)
2237
2252
        tt = self._transform