~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1500
1500
            self.__by_parent = self._transform.by_parent()
1501
1501
        return self.__by_parent
1502
1502
 
 
1503
    def _comparison_data(self, entry, path):
 
1504
        kind, size, executable, link_or_sha1 = self.path_content_summary(path)
 
1505
        if kind == 'missing':
 
1506
            kind = None
 
1507
            executable = False
 
1508
        else:
 
1509
            file_id = self._transform.final_file_id(self._path2trans_id(path))
 
1510
            executable = self.is_executable(file_id, path)
 
1511
        return kind, executable, None
 
1512
 
1503
1513
    def lock_read(self):
1504
1514
        # Perhaps in theory, this should lock the TreeTransform?
1505
1515
        pass
1525
1535
    def __iter__(self):
1526
1536
        return iter(self.all_file_ids())
1527
1537
 
1528
 
    def paths2ids(self, specific_files, trees=None, require_versioned=False):
1529
 
        """See Tree.paths2ids"""
1530
 
        to_find = set(specific_files)
1531
 
        result = set()
1532
 
        for (file_id, paths, changed, versioned, parent, name, kind,
1533
 
             executable) in self._transform.iter_changes():
1534
 
            if paths[1] in to_find:
1535
 
                result.add(file_id)
1536
 
                to_find.remove(paths[1])
1537
 
        result.update(self._transform._tree.paths2ids(to_find,
1538
 
                      trees=[], require_versioned=require_versioned))
1539
 
        return result
 
1538
    def has_id(self, file_id):
 
1539
        if file_id in self._transform._r_new_id:
 
1540
            return True
 
1541
        elif file_id in self._transform._removed_id:
 
1542
            return False
 
1543
        else:
 
1544
            return self._transform._tree.has_id(file_id)
1540
1545
 
1541
1546
    def _path2trans_id(self, path):
1542
1547
        segments = splitpath(path)
1567
1572
        children.update(self._by_parent.get(trans_id, []))
1568
1573
        return children
1569
1574
 
 
1575
    def iter_children(self, file_id):
 
1576
        trans_id = self._transform.trans_id_file_id(file_id)
 
1577
        for child_trans_id in self._all_children(trans_id):
 
1578
            yield self._transform.final_file_id(child_trans_id)
 
1579
 
 
1580
    def extras(self):
 
1581
        possible_extras = set(self._transform.trans_id_tree_path(p) for p
 
1582
                              in self._transform._tree.extras())
 
1583
        possible_extras.update(self._transform._new_contents)
 
1584
        possible_extras.update(self._transform._removed_id)
 
1585
        for trans_id in possible_extras:
 
1586
            if self._transform.final_file_id(trans_id) is None:
 
1587
                yield self._final_paths._determine_path(trans_id)
 
1588
 
1570
1589
    def _make_inv_entries(self, ordered_entries, specific_file_ids):
1571
1590
        for trans_id, parent_file_id in ordered_entries:
1572
1591
            file_id = self._transform.final_file_id(trans_id)
1636
1655
            return self._transform._tree.get_file_mtime(file_id, path)
1637
1656
        return self._stat_limbo_file(file_id).st_mtime
1638
1657
 
 
1658
    def _file_size(self, entry, stat_value):
 
1659
        return self.get_file_size(entry.file_id)
 
1660
 
1639
1661
    def get_file_size(self, file_id):
1640
1662
        """See Tree.get_file_size"""
1641
1663
        if self.kind(file_id) == 'file':
1647
1669
        return self._transform._tree.get_file_sha1(file_id)
1648
1670
 
1649
1671
    def is_executable(self, file_id, path=None):
 
1672
        if file_id is None:
 
1673
            return False
1650
1674
        trans_id = self._transform.trans_id_file_id(file_id)
1651
1675
        try:
1652
1676
            return self._transform._new_executability[trans_id]
1694
1718
        ignored.
1695
1719
        """
1696
1720
        if from_tree is not self._transform._tree:
1697
 
            raise ValueError('from_tree must be transform source tree.')
 
1721
            return tree.InterTree(from_tree, self).iter_changes(
 
1722
                include_unchanged=include_unchanged,
 
1723
                specific_files=specific_files,
 
1724
                pb=pb,
 
1725
                extra_trees=extra_trees,
 
1726
                require_versioned=require_versioned,
 
1727
                want_unversioned=want_unversioned)
1698
1728
        if include_unchanged:
1699
1729
            raise ValueError('include_unchanged is not supported')
1700
1730
        if specific_files is not None: