~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

bug #54172: handle new directories properly in revert

Show diffs side-by-side

added added

removed removed

Lines of Context:
1132
1132
                if file_id not in target_tree:
1133
1133
                    trans_id = tt.trans_id_tree_file_id(file_id)
1134
1134
                    tt.unversion_file(trans_id)
1135
 
                    if file_id in merge_modified:
 
1135
                    try:
 
1136
                        file_kind = working_tree.kind(file_id)
 
1137
                    except NoSuchFile:
 
1138
                        file_kind = None
 
1139
                    if file_kind != 'file' and file_kind is not None:
 
1140
                        keep_contents = False
 
1141
                        delete_merge_modified = False
 
1142
                    else:
 
1143
                        if (file_id in merge_modified and 
 
1144
                            merge_modified[file_id] == 
 
1145
                            working_tree.get_file_sha1(file_id)):
 
1146
                            keep_contents = False
 
1147
                            delete_merge_modified = True
 
1148
                        else:
 
1149
                            keep_contents = True
 
1150
                            delete_merge_modified = False
 
1151
                    if not keep_contents:
1136
1152
                        tt.delete_contents(trans_id)
 
1153
                    if delete_merge_modified:
1137
1154
                        del merge_modified[file_id]
1138
1155
        finally:
1139
1156
            child_pb.finished()