~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2008-04-04 04:20:19 UTC
  • mto: This revision was merged to the branch mainline in revision 3339.
  • Revision ID: aaron@aaronbentley.com-20080404042019-zwpkw158y1411rw7
Don't traceback when adding files to a deleted root (abentley, #210092)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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:
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]