/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-10 07:58:01 UTC
  • mfrom: (3352 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3357.
  • Revision ID: andrew.bennetts@canonical.com-20080410075801-n24st9wfiizkvszp
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1002
1002
            to_executable = False
1003
1003
        return to_name, to_parent, to_kind, to_executable
1004
1004
 
1005
 
    def _iter_changes(self):
1006
 
        """Produce output in the same format as Tree._iter_changes.
 
1005
    def iter_changes(self):
 
1006
        """Produce output in the same format as Tree.iter_changes.
1007
1007
 
1008
1008
        Will produce nonsensical results if invoked while inventory/filesystem
1009
1009
        conflicts (as reported by TreeTransform.find_conflicts()) are present.
1372
1372
    def unlock(self):
1373
1373
        pass
1374
1374
 
1375
 
    def _iter_changes(self, from_tree, include_unchanged=False,
 
1375
    def iter_changes(self, from_tree, include_unchanged=False,
1376
1376
                      specific_files=None, pb=None, extra_trees=None,
1377
1377
                      require_versioned=True, want_unversioned=False):
1378
 
        """See InterTree._iter_changes.
 
1378
        """See InterTree.iter_changes.
1379
1379
 
1380
1380
        This implementation does not support include_unchanged, specific_files,
1381
1381
        or want_unversioned.  extra_trees, require_versioned, and pb are
1389
1389
            raise ValueError('specific_files is not supported')
1390
1390
        if want_unversioned:
1391
1391
            raise ValueError('want_unversioned is not supported')
1392
 
        return self._transform._iter_changes()
 
1392
        return self._transform.iter_changes()
1393
1393
 
1394
1394
    def kind(self, file_id):
1395
1395
        trans_id = self._transform.trans_id_file_id(file_id)
1608
1608
    if accelerator_tree is None:
1609
1609
        new_desired_files = desired_files
1610
1610
    else:
1611
 
        iter = accelerator_tree._iter_changes(tree, include_unchanged=True)
 
1611
        iter = accelerator_tree.iter_changes(tree, include_unchanged=True)
1612
1612
        unchanged = dict((f, p[1]) for (f, p, c, v, d, n, k, e)
1613
1613
                         in iter if not (c or e[0] != e[1]))
1614
1614
        new_desired_files = []
1644
1644
    by_parent = tt.by_parent()
1645
1645
    for child in by_parent[old_parent]:
1646
1646
        tt.adjust_path(tt.final_name(child), new_parent, child)
 
1647
    return by_parent[old_parent]
1647
1648
 
1648
1649
def _content_match(tree, entry, file_id, kind, target_path):
1649
1650
    if entry.kind != kind:
1856
1857
        if change_reporter:
1857
1858
            change_reporter = delta._ChangeReporter(
1858
1859
                unversioned_filter=working_tree.is_ignored)
1859
 
            delta.report_changes(tt._iter_changes(), change_reporter)
 
1860
            delta.report_changes(tt.iter_changes(), change_reporter)
1860
1861
        for conflict in conflicts:
1861
1862
            warning(conflict)
1862
1863
        pp.next_phase()
1872
1873
def _alter_files(working_tree, target_tree, tt, pb, specific_files,
1873
1874
                 backups):
1874
1875
    merge_modified = working_tree.merge_modified()
1875
 
    change_list = target_tree._iter_changes(working_tree,
 
1876
    change_list = target_tree.iter_changes(working_tree,
1876
1877
        specific_files=specific_files, pb=pb)
1877
1878
    if target_tree.inventory.root is None:
1878
1879
        skip_root = True
2019
2020
                new_conflicts.add(('deleting parent', 'Not deleting', 
2020
2021
                                   trans_id))
2021
2022
            except KeyError:
2022
 
                tt.create_directory(trans_id)
2023
 
                new_conflicts.add((c_type, 'Created directory', trans_id))
 
2023
                create = True
2024
2024
                try:
2025
2025
                    tt.final_name(trans_id)
2026
2026
                except NoFinalPath:
2027
2027
                    if path_tree is not None:
2028
2028
                        file_id = tt.final_file_id(trans_id)
 
2029
                        if file_id is None:
 
2030
                            file_id = tt.inactive_file_id(trans_id)
2029
2031
                        entry = path_tree.inventory[file_id]
2030
 
                        parent_trans_id = tt.trans_id_file_id(entry.parent_id)
2031
 
                        tt.adjust_path(entry.name, parent_trans_id, trans_id)
 
2032
                        # special-case the other tree root (move its
 
2033
                        # children to current root)
 
2034
                        if entry.parent_id is None:
 
2035
                            create=False
 
2036
                            moved = _reparent_transform_children(
 
2037
                                tt, trans_id, tt.root)
 
2038
                            for child in moved:
 
2039
                                new_conflicts.add((c_type, 'Moved to root',
 
2040
                                                   child))
 
2041
                        else:
 
2042
                            parent_trans_id = tt.trans_id_file_id(
 
2043
                                entry.parent_id)
 
2044
                            tt.adjust_path(entry.name, parent_trans_id,
 
2045
                                           trans_id)
 
2046
                if create:
 
2047
                    tt.create_directory(trans_id)
 
2048
                    new_conflicts.add((c_type, 'Created directory', trans_id))
2032
2049
        elif c_type == 'unversioned parent':
2033
 
            tt.version_file(tt.inactive_file_id(conflict[1]), conflict[1])
 
2050
            file_id = tt.inactive_file_id(conflict[1])
 
2051
            # special-case the other tree root (move its children instead)
 
2052
            if path_tree and file_id in path_tree:
 
2053
                if path_tree.inventory[file_id].parent_id is None:
 
2054
                    continue
 
2055
            tt.version_file(file_id, conflict[1])
2034
2056
            new_conflicts.add((c_type, 'Versioned directory', conflict[1]))
2035
2057
        elif c_type == 'non-directory parent':
2036
2058
            parent_id = conflict[1]