~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-10 17:16:19 UTC
  • mfrom: (4884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4889.
  • Revision ID: john@arbash-meinel.com-20091210171619-ehdcxjbl8afhq9g1
Bring in bzr.dev 4884

Show diffs side-by-side

added added

removed removed

Lines of Context:
1095
1095
                continue
1096
1096
            new_path = self._limbo_name(trans_id)
1097
1097
            os.rename(old_path, new_path)
 
1098
            for descendant in self._limbo_descendants(trans_id):
 
1099
                desc_path = self._limbo_files[descendant]
 
1100
                desc_path = new_path + desc_path[len(old_path):]
 
1101
                self._limbo_files[descendant] = desc_path
 
1102
 
 
1103
    def _limbo_descendants(self, trans_id):
 
1104
        """Return the set of trans_ids whose limbo paths descend from this."""
 
1105
        descendants = set(self._limbo_children.get(trans_id, []))
 
1106
        for descendant in list(descendants):
 
1107
            descendants.update(self._limbo_descendants(descendant))
 
1108
        return descendants
1098
1109
 
1099
1110
    def create_file(self, contents, trans_id, mode_id=None):
1100
1111
        """Schedule creation of a new file.
1902
1913
    def get_file_mtime(self, file_id, path=None):
1903
1914
        """See Tree.get_file_mtime"""
1904
1915
        if not self._content_change(file_id):
1905
 
            return self._transform._tree.get_file_mtime(file_id, path)
 
1916
            return self._transform._tree.get_file_mtime(file_id)
1906
1917
        return self._stat_limbo_file(file_id).st_mtime
1907
1918
 
1908
1919
    def _file_size(self, entry, stat_value):
1962
1973
                statval = os.lstat(limbo_name)
1963
1974
                size = statval.st_size
1964
1975
                if not supports_executable():
1965
 
                    executable = None
 
1976
                    executable = False
1966
1977
                else:
1967
1978
                    executable = statval.st_mode & S_IEXEC
1968
1979
            else:
1970
1981
                executable = None
1971
1982
            if kind == 'symlink':
1972
1983
                link_or_sha1 = os.readlink(limbo_name).decode(osutils._fs_enc)
1973
 
        if supports_executable():
1974
 
            executable = tt._new_executability.get(trans_id, executable)
 
1984
        executable = tt._new_executability.get(trans_id, executable)
1975
1985
        return kind, size, executable, link_or_sha1
1976
1986
 
1977
1987
    def iter_changes(self, from_tree, include_unchanged=False,
2290
2300
        new_desired_files = desired_files
2291
2301
    else:
2292
2302
        iter = accelerator_tree.iter_changes(tree, include_unchanged=True)
2293
 
        unchanged = dict((f, p[1]) for (f, p, c, v, d, n, k, e)
2294
 
                         in iter if not (c or e[0] != e[1]))
 
2303
        unchanged = [(f, p[1]) for (f, p, c, v, d, n, k, e)
 
2304
                     in iter if not (c or e[0] != e[1])]
 
2305
        if accelerator_tree.supports_content_filtering():
 
2306
            unchanged = [(f, p) for (f, p) in unchanged
 
2307
                         if not accelerator_tree.iter_search_rules([p]).next()]
 
2308
        unchanged = dict(unchanged)
2295
2309
        new_desired_files = []
2296
2310
        count = 0
2297
2311
        for file_id, (trans_id, tree_path) in desired_files: